Use C99 initialisations for iterators
[exim.git] / src / src / routers / rf_change_domain.c
index 049e6ab8c388b782ded1131bb1741725e3ad3aaf..71a6a106cd633ff41544b9854d32f83657db253b 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2009 */
+/* Copyright (c) University of Cambridge 1995 - 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 
@@ -37,8 +37,8 @@ rf_change_domain(address_item *addr, const uschar *domain, BOOL rewrite,
 {
 address_item *parent = store_get(sizeof(address_item));
 uschar *at = Ustrrchr(addr->address, '@');
-uschar *address = string_sprintf("%.*s@%s", at - addr->address, addr->address,
-  domain);
+uschar *address = string_sprintf("%.*s@%s",
+  (int)(at - addr->address), addr->address, domain);
 
 DEBUG(D_route) debug_printf("domain changed to %s\n", domain);
 
@@ -57,6 +57,7 @@ addr->prop = parent->prop;
 addr->address = address;
 addr->unique = string_copy(address);
 addr->parent = parent;
+parent->child_count = 1;
 
 addr->next = *addr_new;
 *addr_new = addr;
@@ -65,17 +66,16 @@ addr->next = *addr_new;
 
 if (rewrite)
   {
-  header_line *h;
   DEBUG(D_route|D_rewrite) debug_printf("rewriting header lines\n");
-  for (h = header_list; h != NULL; h = h->next)
+  for (header_line * h = header_list; h != NULL; h = h->next)
     {
     header_line *newh =
       rewrite_header(h, parent->domain, domain,
         global_rewrite_rules, rewrite_existflags, TRUE);
-    if (newh != NULL)
+    if (newh)
       {
       h = newh;
-      header_rewritten = TRUE;
+      f.header_rewritten = TRUE;
       }
     }
   }