File 0200-Fix-typos-in-erts-emulator-nifs.patch of Package erlang

From dd7e45dde937e9e991112dcea9cd9d599cca7179 Mon Sep 17 00:00:00 2001
From: "Kian-Meng, Ang" <kianmeng@cpan.org>
Date: Thu, 25 Nov 2021 13:28:23 +0800
Subject: [PATCH] Fix typos in erts/emulator/nifs

---
 erts/emulator/nifs/common/prim_net_nif.c    | 10 +++---
 erts/emulator/nifs/common/prim_socket_nif.c | 40 ++++++++++-----------
 erts/emulator/nifs/common/socket_dbg.c      |  2 +-
 erts/emulator/nifs/common/socket_util.c     |  4 +--
 erts/emulator/nifs/win32/win_prim_file.c    |  4 +--
 5 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/erts/emulator/nifs/common/prim_net_nif.c b/erts/emulator/nifs/common/prim_net_nif.c
index cff7031250..29a7ce7d78 100644
--- a/erts/emulator/nifs/common/prim_net_nif.c
+++ b/erts/emulator/nifs/common/prim_net_nif.c
@@ -751,7 +751,7 @@ ERL_NIF_TERM nif_getnameinfo(ErlNifEnv*         env,
 
 
 
-/* Given the provided sock(et) address (and flags), retreive the host and
+/* Given the provided sock(et) address (and flags), retrieve the host and
  * service info.
  */
 #if !defined(__WIN32__) && defined(HAVE_GETNAMEINFO)
@@ -1252,7 +1252,7 @@ ERL_NIF_TERM enet_getifaddrs_process(ErlNifEnv* env, struct ifaddrs* ifap)
 
 
 
-/* Calculate the length of the interface adress linked list
+/* Calculate the length of the interface address linked list
  * The list is NULL-terminated, so the only way is to
  * iterate through the list until we find next = NULL.
  */
@@ -1995,7 +1995,7 @@ ERL_NIF_TERM encode_address_infos(ErlNifEnv*       env,
 
 
 
-/* Calculate the length of the adress info linked list
+/* Calculate the length of the address info linked list
  * The list is NULL-terminated, so the only way is to
  * iterate through the list until we find next = NULL.
  */
@@ -2108,8 +2108,8 @@ void make_address_info(ErlNifEnv*    env,
 /* We should really have another API, so that we can return errno... */
 
 /* *** change network namespace ***
- * Retreive the current namespace and set the new.
- * Return result and previous namespace if successfull.
+ * Retrieve the current namespace and set the new.
+ * Return result and previous namespace if successful.
  */
 #if !defined(__WIN32__)
 static
diff --git a/erts/emulator/nifs/common/prim_socket_nif.c b/erts/emulator/nifs/common/prim_socket_nif.c
index 23015ccdcc..297827c36f 100644
--- a/erts/emulator/nifs/common/prim_socket_nif.c
+++ b/erts/emulator/nifs/common/prim_socket_nif.c
@@ -5083,7 +5083,7 @@ ERL_NIF_TERM esock_open2(ErlNifEnv*   env,
      * Before we do anything else, we try to retrieve domain, type and protocol
      * This information is either present in the eopts map or if not we need
      * to "get" it from the system (getsockopt).
-     * Note that its not possible to get all of these on all platoforms,
+     * Note that its not possible to get all of these on all platforms,
      * and in those cases the user *must* provide us with them (eopts).
      *
      * We try the system first (since its more reliable) and if that fails
@@ -5452,8 +5452,8 @@ BOOLEAN_T esock_open_which_protocol(SOCKET sock, int* proto)
 /* We should really have another API, so that we can return errno... */
 
 /* *** change network namespace ***
- * Retreive the current namespace and set the new.
- * Return result and previous namespace if successfull.
+ * Retrieve the current namespace and set the new.
+ * Return result and previous namespace if successful.
  */
 #ifndef __WIN32__
 static
@@ -6351,7 +6351,7 @@ ERL_NIF_TERM esock_accept_accepting_current_error(ErlNifEnv*       env,
 
 /* *** esock_accept_accepting_other ***
  * Handles when the another acceptor makes an attempt, which
- * results (maybe) in the request beeing pushed onto the
+ * results (maybe) in the request being pushed onto the
  * acceptor queue.
  */
 #ifndef __WIN32__
@@ -6393,7 +6393,7 @@ ERL_NIF_TERM esock_accept_busy_retry(ErlNifEnv*       env,
         ESOCK_ASSERT( DEMONP("esock_accept_busy_retry - select failed",
                              env, descP, &descP->currentAcceptor.mon) == 0);
         /* It is very unlikely that a next acceptor will be able
-         * to do anything succesful, but we will clean the queue
+         * to do anything successful, but we will clean the queue
          */
         if (!activate_next_acceptor(env, descP, sockRef)) {
             SSDBG( descP,
@@ -7645,7 +7645,7 @@ esock_sendfile(ErlNifEnv       *env,
 
             if ((res < 0) && (error == EINVAL)) {
                 /* On e.b SunOS 5.10 using sfv_len > file size
-                 * lands here - we regard this as a succesful send.
+                 * lands here - we regard this as a successful send.
                  * All other causes for EINVAL are avoided,
                  * except for .sfv_fd not seekable, which would
                  * give bytes_sent == 0 that we would interpret
@@ -8819,7 +8819,7 @@ ERL_NIF_TERM esock_finalize_close(ErlNifEnv*       env,
 #endif
 
     /* This nif is executed in a dirty scheduler just so that
-     * it can "hang" (whith minumum effect on the VM) while the
+     * it can "hang" (with minimum effect on the VM) while the
      * kernel writes our buffers. IF we have set the linger option
      * for this ({true, integer() > 0}). For this to work we must
      * be blocking...
@@ -12187,7 +12187,7 @@ ERL_NIF_TERM esock_getopt_pktoptions(ErlNifEnv*       env,
 		  "\r\n", descP->sock, keys[3], vals[3]) );
 	}
 
-	/* Guard agains cut-and-paste errors */
+	/* Guard against cut-and-paste errors */
 	ESOCK_ASSERT( numKeys == NUM(vals) );
 
 	/* Make control message header map */
@@ -13274,7 +13274,7 @@ ERL_NIF_TERM send_check_fail(ErlNifEnv*       env,
 
 /* *** send_error_waiting_writers ***
  *
- * Process all waiting writers when a fatal error has occured.
+ * Process all waiting writers when a fatal error has occurred.
  * All waiting writers will be "aborted", that is a
  * nif_abort message will be sent (with ref and reason).
  */
@@ -13308,7 +13308,7 @@ void send_error_waiting_writers(ErlNifEnv*       env,
 
 /* *** send_check_retry ***
  *
- * Processing done upon uncomplete or blocked send.
+ * Processing done upon incomplete or blocked send.
  *
  * We failed to write the *entire* packet (anything less
  * then size of the packet, which is 0 <= written < sizeof
@@ -13572,7 +13572,7 @@ recv_update_current_reader(ErlNifEnv*       env,
 /* *** recv_error_current_reader ***
  *
  * Process the current reader and any waiting readers
- * when a read (fatal) error has occured.
+ * when a read (fatal) error has occurred.
  * All waiting readers will be "aborted", that is a 
  * nif_abort message will be sent (with ref and reason).
  */
@@ -13743,7 +13743,7 @@ ERL_NIF_TERM recv_check_full(ErlNifEnv*       env,
         /* Send up each chunk of data for each of the read
          * and let the erlang code assemble it: {more, Bin}
          * (when complete it should return {ok, Bin}).
-         * We need to read atleast one more time to be sure if its
+         * We need to read at least one more time to be sure if its
          * done...
          *
          * Also, we need to check if the rNumCnt has reached its max (rNum),
@@ -13950,7 +13950,7 @@ ERL_NIF_TERM recv_check_fail(ErlNifEnv*       env,
 
 /* *** recv_check_fail_econnreset ***
  *
- * We detected that the socket was closed wile reading.
+ * We detected that the socket was closed while reading.
  * Inform current and waiting readers.
  */
 #ifndef __WIN32__
@@ -14051,7 +14051,7 @@ ERL_NIF_TERM recv_check_fail_gen(ErlNifEnv*       env,
 
 /* *** recv_check_partial ***
  *
- * Handle a sucessful recv which only partly filled the specified buffer.
+ * Handle a successful recv which only partly filled the specified buffer.
  */
 #ifndef __WIN32__
 static
@@ -14264,7 +14264,7 @@ ERL_NIF_TERM recvfrom_check_result(ErlNifEnv*       env,
 
     } else {
 
-        /* +++ We sucessfully got a message - time to encode the address +++ */
+        /* +++ We successfully got a message - time to encode the address +++ */
 
         ERL_NIF_TERM eSockAddr;
 
@@ -14371,7 +14371,7 @@ ERL_NIF_TERM recvmsg_check_result(ErlNifEnv*       env,
 
     } else {
 
-        /* +++ We sucessfully got a message - time to encode it +++ */
+        /* +++ We successfully got a message - time to encode it +++ */
 
         res = recvmsg_check_msg(env, descP, read, msgHdrP,
                                 dataBufP, ctrlBufP, sockRef);
@@ -14658,7 +14658,7 @@ void encode_cmsgs(ErlNifEnv*       env,
                         "\r\n   %T: %T"
                         "\r\n", descP->sock, keys[3], vals[3]) );
 
-            /* Guard agains cut-and-paste errors */
+            /* Guard against cut-and-paste errors */
             ESOCK_ASSERT( numKeys == NUM(vals) );
             ESOCK_ASSERT( MKMA(env, keys, vals,
                                numKeys - (have_value ? 0 : 1), &cmsgHdr) );
@@ -15472,7 +15472,7 @@ BOOLEAN_T decode_cmsghdr_value(ErlNifEnv*   env,
         return FALSE;
     }
 
-    // Succesful decode
+    // Successful decode
 
     type = cmsgSpecP->type;
 
@@ -15572,7 +15572,7 @@ BOOLEAN_T decode_cmsghdr_data(ErlNifEnv*   env,
         return FALSE;
     }
 
-    // Succesful decode
+    // Successful decode
 
     SSDBG( descP,
            ("SOCKET",
@@ -17261,7 +17261,7 @@ ESockRequestQueueElement* qpop(ESockRequestQueue* q)
     ESockRequestQueueElement* e = q->first;
     
     if (e != NULL) {
-        /* Atleast one element in the queue */
+        /* At least one element in the queue */
         if (e == q->last) {
             /* Only one element in the queue */
             q->first = q->last = NULL;
diff --git a/erts/emulator/nifs/common/socket_dbg.c b/erts/emulator/nifs/common/socket_dbg.c
index deb531415f..933ce150bf 100644
--- a/erts/emulator/nifs/common/socket_dbg.c
+++ b/erts/emulator/nifs/common/socket_dbg.c
@@ -85,7 +85,7 @@ BOOLEAN_T esock_dbg_init(char* filename)
 
     if (fp != NULL) {
         esock_dbgout = fp;
-        return TRUE; // Succesful file open
+        return TRUE; // Successful file open
     }
 
     esock_dbgout = stdout;
diff --git a/erts/emulator/nifs/common/socket_util.c b/erts/emulator/nifs/common/socket_util.c
index 66db2cf27e..125c30bc58 100644
--- a/erts/emulator/nifs/common/socket_util.c
+++ b/erts/emulator/nifs/common/socket_util.c
@@ -219,7 +219,7 @@ void esock_encode_iov(ErlNifEnv*    env,
  * Decode an IO Vector. In erlang we represented this as a list of binaries.
  *
  * We assume that we have already figured out how long the iov (actually
- * eIOV) is (len), and therefor allocated an array of bins and iov to be
+ * eIOV) is (len), and therefore allocated an array of bins and iov to be
  * used.
  */
 
@@ -817,7 +817,7 @@ void esock_encode_sockaddr_un(ErlNifEnv*          env,
  *    ifindex:  integer()
  *    hatype:   integer() (should be an atom really)
  *    pkttype:  integer() (should be an atom really)
- *    addr:     list()    (should be something usefull...)
+ *    addr:     list()    (should be something useful...)
  *
  */
 
diff --git a/erts/emulator/nifs/win32/win_prim_file.c b/erts/emulator/nifs/win32/win_prim_file.c
index b1412ec1a5..9d74252b8c 100644
--- a/erts/emulator/nifs/win32/win_prim_file.c
+++ b/erts/emulator/nifs/win32/win_prim_file.c
@@ -85,7 +85,7 @@ typedef struct {
     efile_data_t common;
     HANDLE handle;
     /* The following field is only used when the handle has been
-       obtained from an already exisiting file descriptor (i.e.,
+       obtained from an already existing file descriptor (i.e.,
        prim_file:file_desc_to_ref/2). common.modes is set to
        EFILE_MODE_FROM_ALREADY_OPEN_FD when that is the case. It is
        needed because we can't close using handle in that case. */
@@ -428,7 +428,7 @@ static int is_path_root(const efile_path_t *path) {
         path_iterator++;
     }  while(path_iterator < path_end && !IS_SLASH(*path_iterator));
 
-    /* If we're past the end of the string and it didnt't end with a slash,
+    /* If we're past the end of the string and it didn't end with a slash,
      * then we're a root path. */
     return path_iterator >= path_end && !IS_SLASH(path_start[length - 1]);
 }
-- 
2.31.1

openSUSE Build Service is sponsored by