diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2022-01-11 19:20:39 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2022-01-11 19:23:16 +0000 |
commit | 5732024c9991f1e220ad203087997ca467a5cef7 (patch) | |
tree | 6aa6da93adbdc35a53ebd774fdbefbf7e1b2e904 /src | |
parent | fc624b8cb4c3312d7450dfa86adfa3fe8dd9cbeb (diff) |
tidying
Diffstat (limited to 'src')
-rw-r--r-- | src/src/expand.c | 4 | ||||
-rw-r--r-- | src/src/functions.h | 1 | ||||
-rw-r--r-- | src/src/lookups/mysql.c | 23 | ||||
-rw-r--r-- | src/src/lookups/pgsql.c | 29 | ||||
-rw-r--r-- | src/src/search.c | 12 | ||||
-rw-r--r-- | src/src/store.c | 4 |
6 files changed, 29 insertions, 44 deletions
diff --git a/src/src/expand.c b/src/src/expand.c index 3bf87a67c..f1f0a4a38 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -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; diff --git a/src/src/functions.h b/src/src/functions.h index 34a6fb786..ac4ff3b63 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -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); } diff --git a/src/src/lookups/mysql.c b/src/src/lookups/mysql.c index 4e6ca8a72..9cec2158b 100644 --- a/src/src/lookups/mysql.c +++ b/src/src/lookups/mysql.c @@ -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; diff --git a/src/src/lookups/pgsql.c b/src/src/lookups/pgsql.c index a7ea3d57a..c121cb668 100644 --- a/src/src/lookups/pgsql.c +++ b/src/src/lookups/pgsql.c @@ -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; diff --git a/src/src/search.c b/src/src/search.c index 90af54c36..63a1f91de 100644 --- a/src/src/search.c +++ b/src/src/search.c @@ -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 { diff --git a/src/src/store.c b/src/src/store.c index 84f1ce351..8603a8fb1 100644 --- a/src/src/store.c +++ b/src/src/store.c @@ -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); |