]> granicus.if.org Git - mutt/commitdiff
Move mutt_rx_sanitize_string() to muttlib.c
authorKevin McCarthy <kevin@8t8.us>
Sun, 10 Mar 2019 05:35:26 +0000 (13:35 +0800)
committerKevin McCarthy <kevin@8t8.us>
Sun, 10 Mar 2019 10:18:25 +0000 (18:18 +0800)
So it can be converted to use BUFFER.

lib.c
lib.h
muttlib.c
protos.h

diff --git a/lib.c b/lib.c
index 1d294ed2b20966adc934810c5683438580131392..00c322dba4f2739efeafc3a6b5638a4ebdf0bbb2 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -742,30 +742,6 @@ void mutt_sanitize_filename (char *f, short slash)
   }
 }
 
-/* these characters must be escaped in regular expressions */
-
-static const char rx_special_chars[] = "^.[$()|*+?{\\";
-
-int mutt_rx_sanitize_string (char *dest, size_t destlen, const char *src)
-{
-  while (*src && --destlen > 2)
-  {
-    if (strchr (rx_special_chars, *src))
-    {
-      *dest++ = '\\';
-      destlen--;
-    }
-    *dest++ = *src++;
-  }
-
-  *dest = '\0';
-
-  if (*src)
-    return -1;
-  else
-    return 0;
-}
-
 /* Read a line from ``fp'' into the dynamically allocated ``s'',
  * increasing ``s'' if necessary. The ending "\n" or "\r\n" is removed.
  * If a line ends with "\", this char and the linefeed is removed,
diff --git a/lib.h b/lib.h
index 5af75ac838fd29e54e5d69e53f81c2b466e07a9e..f6b4096fba8f22ac63158121c32da871ae981c9b 100644 (file)
--- a/lib.h
+++ b/lib.h
@@ -201,7 +201,6 @@ const char *mutt_basename (const char *);
 int compare_stat (struct stat *, struct stat *);
 int mutt_copy_stream (FILE *, FILE *);
 int mutt_copy_bytes (FILE *, FILE *, size_t);
-int mutt_rx_sanitize_string (char *, size_t, const char *);
 int mutt_strcasecmp (const char *, const char *);
 int mutt_strcmp (const char *, const char *);
 int mutt_strncasecmp (const char *, const char *, size_t);
index f458e7acfa48988bb1bf7533d64d47aa56b41512..00560ed9db1999d1dd29d2cfec49ed135cd8b984 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -862,6 +862,30 @@ void _mutt_mktemp (char *s, size_t slen, const char *prefix, const char *suffix,
     dprint (1, (debugfile, "%s:%d: ERROR: unlink(\"%s\"): %s (errno %d)\n", src, line, s, strerror (errno), errno));
 }
 
+/* these characters must be escaped in regular expressions */
+
+static const char rx_special_chars[] = "^.[$()|*+?{\\";
+
+int mutt_rx_sanitize_string (char *dest, size_t destlen, const char *src)
+{
+  while (*src && --destlen > 2)
+  {
+    if (strchr (rx_special_chars, *src))
+    {
+      *dest++ = '\\';
+      destlen--;
+    }
+    *dest++ = *src++;
+  }
+
+  *dest = '\0';
+
+  if (*src)
+    return -1;
+  else
+    return 0;
+}
+
 void mutt_free_alias (ALIAS **p)
 {
   ALIAS *t;
index 68a617e4af27975d130a7b95c4bf0ccf8ad112a2..c0a04a4d6f74758160a68761fdf857f97cef00a6 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -253,6 +253,7 @@ void mutt_print_patchlist (void);
 void mutt_query_exit (void);
 void mutt_query_menu (char *, size_t);
 void mutt_safe_path (char *s, size_t l, ADDRESS *a);
+int mutt_rx_sanitize_string (char *dest, size_t destlen, const char *src);
 void mutt_save_path (char *s, size_t l, ADDRESS *a);
 void mutt_score_message (CONTEXT *, HEADER *, int);
 void mutt_select_fcc (char *, size_t, HEADER *);