[exim-cvs] tidying: CCSS macro

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Exim Git Commits Mailing List
Ημερομηνία:  
Προς: exim-cvs
Αντικείμενο: [exim-cvs] tidying: CCSS macro
Gitweb: https://git.exim.org/exim.git/commitdiff/3d2e82c5729148f3f88fbb7de7e6dcbc20d0c867
Commit:     3d2e82c5729148f3f88fbb7de7e6dcbc20d0c867
Parent:     163144aab02a47427340d0ecc75e2abde675f4c9
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sat Jan 11 20:48:38 2020 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sat Jan 11 20:48:38 2020 +0000


    tidying: CCSS macro
---
 src/exim_monitor/em_init.c      | 7 +++----
 src/src/auths/call_pwcheck.c    | 2 +-
 src/src/auths/cyrus_sasl.c      | 8 ++++----
 src/src/exim.c                  | 2 +-
 src/src/expand.c                | 4 ++--
 src/src/filter.c                | 6 ++----
 src/src/lookups/redis.c         | 3 +--
 src/src/malware.c               | 5 ++---
 src/src/mytypes.h               | 1 +
 src/src/tls-gnu.c               | 2 +-
 src/src/transports/appendfile.c | 5 ++---
 src/src/transports/tf_maildir.c | 6 ++----
 12 files changed, 22 insertions(+), 29 deletions(-)


diff --git a/src/exim_monitor/em_init.c b/src/exim_monitor/em_init.c
index c9ef66a..b834d9a 100644
--- a/src/exim_monitor/em_init.c
+++ b/src/exim_monitor/em_init.c
@@ -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 */
diff --git a/src/src/auths/call_pwcheck.c b/src/src/auths/call_pwcheck.c
index 089f501..cf21a18 100644
--- a/src/src/auths/call_pwcheck.c
+++ b/src/src/auths/call_pwcheck.c
@@ -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);
diff --git a/src/src/auths/cyrus_sasl.c b/src/src/auths/cyrus_sasl.c
index 4b4f45b..37e7898 100644
--- a/src/src/auths/cyrus_sasl.c
+++ b/src/src/auths/cyrus_sasl.c
@@ -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)
diff --git a/src/src/exim.c b/src/src/exim.c
index 92f5623..3be3bf0 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -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)
diff --git a/src/src/expand.c b/src/src/expand.c
index be6cd61..cec6efd 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -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 "
diff --git a/src/src/filter.c b/src/src/filter.c
index 3da6167..98b6bc3 100644
--- a/src/src/filter.c
+++ b/src/src/filter.c
@@ -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",
diff --git a/src/src/lookups/redis.c b/src/src/lookups/redis.c
index 1b53eed..53bd8d5 100644
--- a/src/src/lookups/redis.c
+++ b/src/src/lookups/redis.c
@@ -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;
diff --git a/src/src/malware.c b/src/src/malware.c
index 481b46a..ef27daf 100644
--- a/src/src/malware.c
+++ b/src/src/malware.c
@@ -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;
 }


diff --git a/src/src/mytypes.h b/src/src/mytypes.h
index fd33168..eba3f7e 100644
--- a/src/src/mytypes.h
+++ b/src/src/mytypes.h
@@ -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
diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c
index 34ebc09..028d062 100644
--- a/src/src/tls-gnu.c
+++ b/src/src/tls-gnu.c
@@ -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);
diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c
index 8f26c71..561ee02 100644
--- a/src/src/transports/appendfile.c
+++ b/src/src/transports/appendfile.c
@@ -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,
diff --git a/src/src/transports/tf_maildir.c b/src/src/transports/tf_maildir.c
index 611895e..4d5c0c1 100644
--- a/src/src/transports/tf_maildir.c
+++ b/src/src/transports/tf_maildir.c
@@ -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,