]> granicus.if.org Git - neomutt/commitdiff
buf,buflen
authorRichard Russon <rich@flatcap.org>
Thu, 16 Aug 2018 23:49:15 +0000 (00:49 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 17 Aug 2018 01:55:41 +0000 (02:55 +0100)
mutt/string.c
mutt/string2.h
muttlib.c

index 1c09e9e0c1d22910840e615f81345125957fa1f2..a8698e02fd49812ccfe00da30c953b45198ea7da 100644 (file)
@@ -296,26 +296,26 @@ char *mutt_str_strdup(const char *str)
 
 /**
  * mutt_str_strcat - Concatenate two strings
- * @param d Buffer containing source string
- * @param l Length of buffer
- * @param s String to add
+ * @param buf    Buffer containing source string
+ * @param buflen Length of buffer
+ * @param s      String to add
  * @retval ptr Start of joined string
  */
-char *mutt_str_strcat(char *d, size_t l, const char *s)
+char *mutt_str_strcat(char *buf, size_t buflen, const char *s)
 {
-  char *p = d;
+  char *p = buf;
 
-  if (!l)
-    return d;
+  if (!buflen)
+    return buf;
 
-  l--; /* Space for the trailing '\0'. */
+  buflen--; /* Space for the trailing '\0'. */
 
-  for (; *d && l; l--)
-    d++;
-  for (; *s && l; l--)
-    *d++ = *s++;
+  for (; *buf && buflen; buflen--)
+    buf++;
+  for (; *s && buflen; buflen--)
+    *buf++ = *s++;
 
-  *d = '\0';
+  *buf = '\0';
 
   return p;
 }
index bddf7c58ec7485d45794d350547146f10d90bae0..cd931a7315a07213b8aa842d14603093b89c8bb2 100644 (file)
@@ -83,7 +83,7 @@ const char *mutt_str_rstrnstr(const char *haystack, size_t haystack_length, cons
 char *      mutt_str_skip_email_wsp(const char *s);
 char *      mutt_str_skip_whitespace(char *p);
 int         mutt_str_strcasecmp(const char *a, const char *b);
-char *      mutt_str_strcat(char *d, size_t l, const char *s);
+char *      mutt_str_strcat(char *buf, size_t buflen, const char *s);
 const char *mutt_str_strchrnul(const char *s, char c);
 int         mutt_str_strcmp(const char *a, const char *b);
 int         mutt_str_strcoll(const char *a, const char *b);
index 01c61bc729943599a70c211ea62c18d1d5bd9bc5..2c3c0889c72465a25b1f3856f01a1961ff8e2396 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -538,24 +538,24 @@ void mutt_mktemp_full(char *buf, size_t buflen, const char *prefix,
 
 /**
  * mutt_pretty_mailbox - Shorten a mailbox path using '~' or '='
- * @param s      Buffer containing string to shorten
+ * @param buf    Buffer containing string to shorten
  * @param buflen Length of buffer
  *
  * Collapse the pathname using ~ or = when possible
  */
-void mutt_pretty_mailbox(char *s, size_t buflen)
+void mutt_pretty_mailbox(char *buf, size_t buflen)
 {
-  char *p = s, *q = s;
+  char *p = buf, *q = buf;
   size_t len;
   enum UrlScheme scheme;
   char tmp[PATH_MAX];
 
-  scheme = url_check_scheme(s);
+  scheme = url_check_scheme(buf);
 
 #ifdef USE_IMAP
   if (scheme == U_IMAP || scheme == U_IMAPS)
   {
-    imap_pretty_mailbox(s);
+    imap_pretty_mailbox(buf);
     return;
   }
 #endif
@@ -565,10 +565,10 @@ void mutt_pretty_mailbox(char *s, size_t buflen)
     return;
 #endif
 
-  /* if s is an url, only collapse path component */
+  /* if buf is an url, only collapse path component */
   if (scheme != U_UNKNOWN)
   {
-    p = strchr(s, ':') + 1;
+    p = strchr(buf, ':') + 1;
     if (strncmp(p, "//", 2) == 0)
       q = strchr(p + 2, '/');
     if (!q)
@@ -600,19 +600,19 @@ void mutt_pretty_mailbox(char *s, size_t buflen)
     *q = 0;
   }
   else if (strstr(p, "..") && (scheme == U_UNKNOWN || scheme == U_FILE) && realpath(p, tmp))
-    mutt_str_strfcpy(p, tmp, buflen - (p - s));
+    mutt_str_strfcpy(p, tmp, buflen - (p - buf));
 
   len = mutt_str_strlen(Folder);
-  if ((mutt_str_strncmp(s, Folder, len) == 0) && s[len] == '/')
+  if ((mutt_str_strncmp(buf, Folder, len) == 0) && buf[len] == '/')
   {
-    *s++ = '=';
-    memmove(s, s + len, mutt_str_strlen(s + len) + 1);
+    *buf++ = '=';
+    memmove(buf, buf + len, mutt_str_strlen(buf + len) + 1);
   }
-  else if ((mutt_str_strncmp(s, HomeDir, (len = mutt_str_strlen(HomeDir))) == 0) &&
-           s[len] == '/')
+  else if ((mutt_str_strncmp(buf, HomeDir, (len = mutt_str_strlen(HomeDir))) == 0) &&
+           buf[len] == '/')
   {
-    *s++ = '~';
-    memmove(s, s + len - 1, mutt_str_strlen(s + len - 1) + 1);
+    *buf++ = '~';
+    memmove(buf, buf + len - 1, mutt_str_strlen(buf + len - 1) + 1);
   }
 }