tidying
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 11 Jan 2022 19:20:39 +0000 (19:20 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 11 Jan 2022 19:23:16 +0000 (19:23 +0000)
src/src/expand.c
src/src/functions.h
src/src/lookups/mysql.c
src/src/lookups/pgsql.c
src/src/search.c
src/src/store.c

index 3bf87a67c17d092f616f425112679f95ef52eac9..f1f0a4a3819ca53e4ef93d82aaa1e8cad25f000c 100644 (file)
@@ -177,7 +177,7 @@ in alphabetical order. There are two tables, because underscore is used in some
 cases to introduce arguments, whereas for other it is part of the name. This is
 an historical mis-design. */
 
-static uschar *op_table_underscore[] = {
+static uschar * op_table_underscore[] = {
   US"from_utf8",
   US"local_part",
   US"quote_local_part",
@@ -7564,7 +7564,7 @@ while (*s)
       else
         {
         int n;
-        uschar *opt = Ustrchr(arg, '_');
+        uschar * opt = Ustrchr(arg, '_');
 
         if (opt) *opt++ = 0;
 
index 34a6fb7862daec4c880079f348f72def525de019..ac4ff3b637ba8657df5d557d25c1091c139176b2 100644 (file)
@@ -989,7 +989,6 @@ could be used and would handle that implicitly. */
 static inline dns_answer *
 store_get_dns_answer_trc(const uschar * func, unsigned line)
 {
-/* return store_get_3(sizeof(dns_answer), TRUE, CCS func, line);   use tainted mem */
 return store_malloc_3(sizeof(dns_answer), CCS func, line);
 }
 
index 4e6ca8a72cd813b034b8684a5915ac41137d72fb..9cec2158b3c5032ae17279dd2b125a494593c5d2 100644 (file)
@@ -416,38 +416,33 @@ Returns:     the processed string or NULL for a bad option
 */
 
 static uschar *
-mysql_quote(uschar *s, uschar *opt)
+mysql_quote(uschar * s, uschar * opt)
 {
 register int c;
 int count = 0;
 uschar *t = s;
 uschar *quoted;
 
-if (opt != NULL) return NULL;     /* No options recognized */
+if (opt) return NULL;     /* No options recognized */
 
-while ((c = *t++) != 0)
+while ((c = *t++))
   if (Ustrchr("\n\t\r\b\'\"\\", c) != NULL) count++;
 
 if (count == 0) return s;
 t = quoted = store_get(Ustrlen(s) + count + 1, is_tainted(s));
 
-while ((c = *s++) != 0)
+while ((c = *s++))
   {
   if (Ustrchr("\n\t\r\b\'\"\\", c) != NULL)
     {
     *t++ = '\\';
     switch(c)
       {
-      case '\n': *t++ = 'n';
-      break;
-      case '\t': *t++ = 't';
-      break;
-      case '\r': *t++ = 'r';
-      break;
-      case '\b': *t++ = 'b';
-      break;
-      default:   *t++ = c;
-      break;
+      case '\n': *t++ = 'n'; break;
+      case '\t': *t++ = 't'; break;
+      case '\r': *t++ = 'r'; break;
+      case '\b': *t++ = 'b'; break;
+      default:   *t++ = c;   break;
       }
     }
   else *t++ = c;
index a7ea3d57a0957bd3c4415d9018d22abe72d2b0b8..c121cb66810cc1473277e677f6a4fe1a35da9781 100644 (file)
@@ -418,22 +418,20 @@ Returns:     the processed string or NULL for a bad option
 */
 
 static uschar *
-pgsql_quote(uschar *s, uschar *opt)
+pgsql_quote(uschar * s, uschar * opt)
 {
-register int c;
-int count = 0;
-uschar *t = s;
-uschar *quoted;
+int count = 0, c;
+uschar * t = s, * quoted;
 
-if (opt != NULL) return NULL;     /* No options recognized */
+if (opt) return NULL;     /* No options recognized */
 
-while ((c = *t++) != 0)
+while ((c = *t++))
   if (Ustrchr("\n\t\r\b\'\"\\", c) != NULL) count++;
 
 if (count == 0) return s;
 t = quoted = store_get(Ustrlen(s) + count + 1, is_tainted(s));
 
-while ((c = *s++) != 0)
+while ((c = *s++))
   {
   if (c == '\'')
     {
@@ -445,16 +443,11 @@ while ((c = *s++) != 0)
     *t++ = '\\';
     switch(c)
       {
-      case '\n': *t++ = 'n';
-      break;
-      case '\t': *t++ = 't';
-      break;
-      case '\r': *t++ = 'r';
-      break;
-      case '\b': *t++ = 'b';
-      break;
-      default:   *t++ = c;
-      break;
+      case '\n': *t++ = 'n'; break;
+      case '\t': *t++ = 't'; break;
+      case '\r': *t++ = 'r'; break;
+      case '\b': *t++ = 'b'; break;
+      default:   *t++ = c;   break;
       }
     }
   else *t++ = c;
index 90af54c36d2fd9ca1d891dd5e1fa4ae89587e9e7..63a1f91de81f9d2c629f95deb5db9d814fb6c2d3 100644 (file)
@@ -63,11 +63,9 @@ Returns:     +ve => valid lookup name; value is offset in lookup_list
 */
 
 int
-search_findtype(const uschar *name, int len)
+search_findtype(const uschar * name, int len)
 {
-int bot = 0;
-int top = lookup_list_count;
-while (top > bot)
+for (int bot = 0, top = lookup_list_count; top > bot; )
   {
   int mid = (top + bot)/2;
   int c = Ustrncmp(name, lookup_list[mid]->name, len);
@@ -92,7 +90,7 @@ while (top > bot)
   if (c > 0) bot = mid + 1; else top = mid;
   }
 
-search_error_message = string_sprintf("unknown lookup type \"%.*s\"",len,name);
+search_error_message = string_sprintf("unknown lookup type \"%.*s\"", len, name);
 return -1;
 }
 
@@ -615,8 +613,8 @@ else
     e->data.ptr = data;
     }
 
-  /* If caching was disabled, empty the cache tree. We just set the cache
-  pointer to NULL here, because we cannot release the store at this stage. */
+/* If caching was disabled, empty the cache tree. We just set the cache
+pointer to NULL here, because we cannot release the store at this stage. */
 
   else
     {
index 84f1ce351a3055e98a2a0e0ddb05cbaec398a9cc..8603a8fb11e568cef40de7e2b659e32554333c30 100644 (file)
@@ -418,9 +418,9 @@ Returns:      pointer to store (panic on malloc failure)
 */
 
 void *
-store_get_perm_3(int size, BOOL tainted, const char *func, int linenumber)
+store_get_perm_3(int size, BOOL tainted, const char * func, int linenumber)
 {
-void *yield;
+void * yield;
 int old_pool = store_pool;
 store_pool = POOL_PERM;
 yield = store_get_3(size, tainted, func, linenumber);