gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: MHD_str_remove_token_caseless_():


From: gnunet
Subject: [libmicrohttpd] branch master updated: MHD_str_remove_token_caseless_(): clarified comments
Date: Tue, 02 Nov 2021 19:30:19 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new fa4a35d9 MHD_str_remove_token_caseless_(): clarified comments
fa4a35d9 is described below

commit fa4a35d9d5921e7dbfdc251a3a231638bc23d549
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue Nov 2 21:29:57 2021 +0300

    MHD_str_remove_token_caseless_(): clarified comments
---
 src/microhttpd/mhd_str.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/microhttpd/mhd_str.c b/src/microhttpd/mhd_str.c
index 31cc20b0..4222cbab 100644
--- a/src/microhttpd/mhd_str.c
+++ b/src/microhttpd/mhd_str.c
@@ -588,8 +588,9 @@ MHD_str_remove_token_caseless_ (const char *str,
     if ((size_t) (s1 - str) >= str_len)
       break; /* Nothing to copy, end of the input string */
 
-    cur_token = s1; /* the first char of input token or
-                       the char after the input buffer */
+    /* 's1' points to the first char of token in the input string */
+
+    cur_token = s1; /* the first char of input token */
 
     /* Check the token with case-insensetive match */
     t_pos = 0;
@@ -599,6 +600,7 @@ MHD_str_remove_token_caseless_ (const char *str,
       s1++;
       t_pos++;
     }
+    /* s1 may point just beyond the end of the input string */
     if ( (token_len == t_pos) && (0 != token_len) )
     {
       /* 'token' matched, check that current input token does not have
@@ -616,10 +618,11 @@ MHD_str_remove_token_caseless_ (const char *str,
       }
     }
 
-    /* 's1' points to some non-whitespace char in the token in the input
-     * string, to the ',', or just beyond the end of the input string */
-    /* The current token in the input string does not match excluded token,
-     * it must be copied to the output string */
+    /* 's1' points to first non-whitespace char, to some char after
+     * first non-whitespace char in the token in the input string, to
+     * the ',', or just beyond the end of the input string */
+    /* The current token in the input string does not match the token
+     * to exclude, it must be copied to the output string */
     /* the current token size excluding leading whitespaces and current char */
     copy_size = (size_t) (s1 - cur_token);
     if (buf == s2)
@@ -649,7 +652,10 @@ MHD_str_remove_token_caseless_ (const char *str,
 
     while ( ((size_t) (s1 - str) < str_len) && (',' != *s1))
     {
-      /* 's1' points to some non-whitespace char in the token */
+      /* 's1' points to first non-whitespace char, to some char after
+       * first non-whitespace char in the token in the input string */
+      /* Copy all non-whitespace chars from the current token in
+       * the input string */
       while ( ((size_t) (s1 - str) < str_len) &&
               (',' != *s1) && (' ' != *s1) && ('\t' != *s1) )
       {
@@ -668,7 +674,8 @@ MHD_str_remove_token_caseless_ (const char *str,
         s1++;
 
       /* 's1' points to the first non-whitespace char in the input string
-       * after whitespace chars or just beyond the end of the input string */
+       * after whitespace chars, to the ',', or just beyond the end of
+       * the input string */
       if (((size_t) (s1 - str) < str_len) && (',' != *s1))
       { /* Not the end of the current token */
         if (buf + *buf_size <= s2) /* '<= s2' equals '< s2 + 1' */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]