tidying
[exim.git] / src / src / expand.c
index 3d48301a131020b029ed17f476f830a19fb00b86..f1f0a4a3819ca53e4ef93d82aaa1e8cad25f000c 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 */
+/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 
@@ -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",
@@ -1760,8 +1760,6 @@ const uschar * where;
 #ifndef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS
 uschar * sname;
 #endif
-fd_set fds;
-struct timeval tv;
 
 if ((fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
   {
@@ -1805,9 +1803,7 @@ if (connect(fd, (const struct sockaddr *)&sa_un, len) < 0)
 buf[0] = NOTIFY_QUEUE_SIZE_REQ;
 if (send(fd, buf, 1, 0) < 0) { where = US"send"; goto bad; }
 
-FD_ZERO(&fds); FD_SET(fd, &fds);
-tv.tv_sec = 2; tv.tv_usec = 0;
-if (select(fd + 1, (SELECT_ARG2_TYPE *)&fds, NULL, NULL, &tv) != 1)
+if (poll_one_fd(fd, POLLIN, 2 * 1000) != 1)
   {
   DEBUG(D_expand) debug_printf("no daemon response; using local evaluation\n");
   len = snprintf(CS buf, sizeof(buf), "%u", queue_count_cached());
@@ -2982,7 +2978,7 @@ switch(cond_type = identify_operator(&s, &opname))
        uschar errbuf[128];
        pcre2_get_error_message(err, errbuf, sizeof(errbuf));
        expand_string_message = string_sprintf("regular expression error in "
-         "\"%s\": %s at offset %d", sub[1], errbuf, offset);
+         "\"%s\": %s at offset %ld", sub[1], errbuf, (long)offset);
        return NULL;
        }
 
@@ -3494,9 +3490,9 @@ switch(cond_type = identify_operator(&s, &opname))
 
     srs_recipient = string_sprintf("%.*s%.*S%.*s@%.*S",        /* lowercased */
                      quoting, "\"",
-                     ovec[9]-ovec[8], sub[0] + ovec[8],        /* substring 4 */
+                     (int) (ovec[9]-ovec[8]), sub[0] + ovec[8],  /* substr 4 */
                      quoting, "\"",
-                     ovec[7]-ovec[6], sub[0] + ovec[6]);       /* substring 3 */
+                     (int) (ovec[7]-ovec[6]), sub[0] + ovec[6]); /* substr 3 */
 
     /* If a zero-length secret was given, we're done.  Otherwise carry on
     and validate the given SRS local_part againt our secret. */
@@ -4319,7 +4315,6 @@ tree_node *t = NULL;
 const uschar * list;
 int sep = 0;
 uschar * item;
-uschar * suffix = US"";
 BOOL needsep = FALSE;
 #define LISTNAMED_BUF_SIZE 256
 uschar b[LISTNAMED_BUF_SIZE];
@@ -4335,10 +4330,10 @@ if (!listtype)          /* no-argument version */
   }
 else switch(*listtype) /* specific list-type version */
   {
-  case 'a': t = tree_search(addresslist_anchor,   name); suffix = US"_a"; break;
-  case 'd': t = tree_search(domainlist_anchor,    name); suffix = US"_d"; break;
-  case 'h': t = tree_search(hostlist_anchor,      name); suffix = US"_h"; break;
-  case 'l': t = tree_search(localpartlist_anchor, name); suffix = US"_l"; break;
+  case 'a': t = tree_search(addresslist_anchor,   name); break;
+  case 'd': t = tree_search(domainlist_anchor,    name); break;
+  case 'h': t = tree_search(hostlist_anchor,      name); break;
+  case 'l': t = tree_search(localpartlist_anchor, name); break;
   default:
     expand_string_message = US"bad suffix on \"list\" operator";
     return yield;
@@ -7569,7 +7564,7 @@ while (*s)
       else
         {
         int n;
-        uschar *opt = Ustrchr(arg, '_');
+        uschar * opt = Ustrchr(arg, '_');
 
         if (opt) *opt++ = 0;