tidying: CCSS macro
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 11 Jan 2020 20:48:38 +0000 (20:48 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 11 Jan 2020 20:48:38 +0000 (20:48 +0000)
12 files changed:
src/exim_monitor/em_init.c
src/src/auths/call_pwcheck.c
src/src/auths/cyrus_sasl.c
src/src/exim.c
src/src/expand.c
src/src/filter.c
src/src/lookups/redis.c
src/src/malware.c
src/src/mytypes.h
src/src/tls-gnu.c
src/src/transports/appendfile.c
src/src/transports/tf_maildir.c

index c9ef66a7e4c5df5d9465ad2bf8e6108659865179..b834d9a2b3c98d560bea77df08486f7734a9e0ed 100644 (file)
@@ -70,9 +70,8 @@ for (i = 0; i <= 1; i++)
         {
         int offset;
         const uschar *error;
-        stripchart_regex[indx] = pcre_compile(CS buffer, PCRE_COPT,
-          (const char **)&error, &offset, NULL);
-        if (stripchart_regex[indx] == NULL)
+        if (!(stripchart_regex[indx] = pcre_compile(CS buffer, PCRE_COPT,
+          CCSS &error, &offset, NULL)))
           {
           printf("regular expression error: %s at offset %d "
             "while compiling %s\n", error, offset, buffer);
@@ -231,7 +230,7 @@ queue_stripchart_name = (s != NULL)? string_copy(s) : US"queue";
 /* Compile the regex for matching yyyy-mm-dd at the start of a string. */
 
 yyyymmdd_regex = pcre_compile("^\\d{4}-\\d\\d-\\d\\d\\s", PCRE_COPT,
-  (const char **)&error, &erroroffset, NULL);
+  CCSS &error, &erroroffset, NULL);
 }
 
 /* End of em_init.c */
index 089f501a7b73d463193ef7bafd77f71b9072d2dc..cf21a18c0cf347a37fef848ffb4f150e0a711bfa 100644 (file)
@@ -49,7 +49,7 @@ if (pw == NULL)
 DEBUG(D_auth)
   debug_printf("Running pwcheck authentication for user \"%s\"\n", s);
 
-switch (pwcheck_verify_password(CS s, CS pw, (const char **)(&reply)))
+switch (pwcheck_verify_password(CS s, CS pw, CCSS &reply))
   {
   case PWCHECK_OK:
   DEBUG(D_auth) debug_printf("pwcheck: success (%s)\n", reply);
index 4b4f45b94f07481c4ffba43ae8c3757ee6b4bbdb..37e78989fbae96fc46cab022145b71490eac7f92 100644 (file)
@@ -151,7 +151,7 @@ if ((rc = sasl_server_new(CS ob->server_service, CS expanded_hostname,
   log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator:  "
       "couldn't initialise Cyrus SASL server connection.", ablock->name);
 
-if ((rc = sasl_listmech(conn, NULL, "", ":", "", (const char **)&list, &len, &i)) != SASL_OK)
+if ((rc = sasl_listmech(conn, NULL, "", ":", "", CCSS &list, &len, &i)) != SASL_OK)
   log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s authenticator:  "
       "couldn't get Cyrus SASL mechanism list.", ablock->name);
 
@@ -326,8 +326,8 @@ for (rc = SASL_CONTINUE; rc == SASL_CONTINUE; )
     {
     firsttime = 0;
     HDEBUG(D_auth) debug_printf("Calling sasl_server_start(%s,\"%s\")\n", ob->server_mech, debug);
-    rc = sasl_server_start(conn, CS ob->server_mech, inlen?CS input:NULL, inlen,
-           (const char **)(&output), &outlen);
+    rc = sasl_server_start(conn, CS ob->server_mech, inlen ? CS input : NULL, inlen,
+           CCSS &output, &outlen);
     }
   else
     {
@@ -358,7 +358,7 @@ for (rc = SASL_CONTINUE; rc == SASL_CONTINUE; )
       }
 
     HDEBUG(D_auth) debug_printf("Calling sasl_server_step(\"%s\")\n", debug);
-    rc = sasl_server_step(conn, CS input, inlen, (const char **)(&output), &outlen);
+    rc = sasl_server_step(conn, CS input, inlen, CCSS &output, &outlen);
     }
 
   if (rc == SASL_BADPROT)
index 92f5623d23af304dbd3ee9c4de7c59fc7f7a1c70..3be3bf039a23caf98e49bd18df0dfc55fafaef4a 100644 (file)
@@ -110,7 +110,7 @@ if (use_malloc)
   pcre_free = function_store_free;
   }
 if (caseless) options |= PCRE_CASELESS;
-yield = pcre_compile(CCS pattern, options, (const char **)&error, &offset, NULL);
+yield = pcre_compile(CCS pattern, options, CCSS &error, &offset, NULL);
 pcre_malloc = function_store_get;
 pcre_free = function_dummy_free;
 if (yield == NULL)
index be6cd616250957aa60bee30cab69d70fcb2cb216..cec6efd54ba2e879062c0bf0e7f369a8179657b4 100644 (file)
@@ -2893,7 +2893,7 @@ switch(cond_type = identify_operator(&s, &opname))
     break;
 
     case ECOND_MATCH:   /* Regular expression match */
-    if (!(re = pcre_compile(CS sub[1], PCRE_COPT, (const char **)&rerror,
+    if (!(re = pcre_compile(CS sub[1], PCRE_COPT, CCSS &rerror,
                            &roffset, NULL)))
       {
       expand_string_message = string_sprintf("regular expression error in "
@@ -5834,7 +5834,7 @@ while (*s != 0)
 
       /* Compile the regular expression */
 
-      if (!(re = pcre_compile(CS sub[1], PCRE_COPT, (const char **)&rerror,
+      if (!(re = pcre_compile(CS sub[1], PCRE_COPT, CCSS &rerror,
                              &roffset, NULL)))
         {
         expand_string_message = string_sprintf("regular expression error in "
index 3da616700a2259c640b9ea83500f844575f1339a..98b6bc3e84a72c57cb5987d036ba213f98fa2b15 100644 (file)
@@ -1595,11 +1595,9 @@ switch (c->type)
       debug_printf_indent("  Pattern = %s\n", exp[1]);
       }
 
-    re = pcre_compile(CS exp[1],
+    if (!(re = pcre_compile(CS exp[1],
       PCRE_COPT | ((c->type == cond_matches)? PCRE_CASELESS : 0),
-      (const char **)&regcomp_error, &regcomp_error_offset, NULL);
-
-    if (re == NULL)
+      CCSS &regcomp_error, &regcomp_error_offset, NULL)))
       {
       *error_pointer = string_sprintf("error while compiling "
         "regular expression \"%s\": %s at offset %d",
index 1b53eed69cec940067c413f87d231e4a3bc9d2ad..53bd8d53d8d840de1f282fd3b6dba76b481a3150 100644 (file)
@@ -227,8 +227,7 @@ if(sdata[1])
   /* Run the command. We use the argv form rather than plain as that parses
   into args by whitespace yet has no escaping mechanism. */
 
-  redis_reply = redisCommandArgv(redis_handle, i, (const char **) argv, NULL);
-  if (!redis_reply)
+  if (!(redis_reply = redisCommandArgv(redis_handle, i, CCSS argv, NULL)))
     {
     *errmsg = string_sprintf("REDIS: query failed: %s\n", redis_handle->errstr);
     *defer_break = FALSE;
index 481b46acc2ee4d5971b22b175124003b61d97bb2..ef27daf377b2d336ef354979dae2e62f23138dfa 100644 (file)
@@ -302,8 +302,7 @@ const uschar * rerror;
 int roffset;
 const pcre * cre;
 
-cre = pcre_compile(CS re, PCRE_COPT, (const char **)&rerror, &roffset, NULL);
-if (!cre)
+if (!(cre = pcre_compile(CS re, PCRE_COPT, CCSS &rerror, &roffset, NULL)))
   *errstr= string_sprintf("regular expression error in '%s': %s at offset %d",
       re, rerror, roffset);
 return cre;
@@ -317,7 +316,7 @@ int i = pcre_exec(cre, NULL, CS text, Ustrlen(text), 0, 0,
              ovector, nelem(ovector));
 uschar * substr = NULL;
 if (i >= 2)                            /* Got it */
-  pcre_get_substring(CS text, ovector, i, 1, (const char **) &substr);
+  pcre_get_substring(CS text, ovector, i, 1, CCSS &substr);
 return substr;
 }
 
index fd33168f717dc692c49b8c0c12135c15c3dba5d0..eba3f7e9de8993c2f01d65dc27f7abe1e5c7b9d2 100644 (file)
@@ -77,6 +77,7 @@ almost always literal strings. */
 #define CUS  (const unsigned char *)
 #define USS  (unsigned char **)
 #define CUSS (const unsigned char **)
+#define CCSS (const char **)
 
 /* The C library string functions expect "char *" arguments. Use macros to
 avoid having to write a cast each time. We do this for string and file
index 34ebc0903114a5414ac8c0c48bc2a8b46cdf2a6c..028d06219ca02936d95fc49be094040da6ce8b39 100644 (file)
@@ -1939,7 +1939,7 @@ else
       const char ** dd;
       int * ddl;
 
-      for(nrec = 0; state->dane_data_len[nrec]; ) nrec++;
+      for (nrec = 0; state->dane_data_len[nrec]; ) nrec++;
       nrec++;
 
       dd = store_get(nrec * sizeof(uschar *), FALSE);
index 8f26c71ba3b7e99b949369c207c28c89e3c1c581..561ee026224a258907128535a3565ecb14d9c0c2 100644 (file)
@@ -2395,9 +2395,8 @@ else
       {
       int check_path_len = Ustrlen(check_path);
 
-      dir_regex = pcre_compile(CS ob->maildir_dir_regex, PCRE_COPT,
-        (const char **)&error, &offset, NULL);
-      if (dir_regex == NULL)
+      if (!(dir_regex = pcre_compile(CS ob->maildir_dir_regex, PCRE_COPT,
+        CCSS &error, &offset, NULL)))
         {
         addr->message = string_sprintf("appendfile: regular expression "
           "error: %s at offset %d while compiling %s", error, offset,
index 611895e064a72aac70be4e4f491fe36e98bb527f..4d5c0c1a9a1960c0aa42e0c2c34f7cb5b6edd689 100644 (file)
@@ -147,10 +147,8 @@ if (maildirfolder_create_regex != NULL)
 
   DEBUG(D_transport) debug_printf("checking for maildirfolder requirement\n");
 
-  regex = pcre_compile(CS maildirfolder_create_regex, PCRE_COPT,
-    (const char **)&error, &offset, NULL);
-
-  if (regex == NULL)
+  if (!(regex = pcre_compile(CS maildirfolder_create_regex, PCRE_COPT,
+    CCSS &error, &offset, NULL)))
     {
     addr->message = string_sprintf("appendfile: regular expression "
       "error: %s at offset %d while compiling %s", error, offset,