From 8cfd0f7b84730e10238219bd5b93677519ecbb16 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 8 Nov 2016 22:41:42 +0000 Subject: [PATCH] tidying --- src/src/daemon.c | 8 +++----- src/src/rda.c | 16 +++++++--------- src/src/tls-openssl.c | 2 +- test/src/server.c | 9 ++++++--- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/src/daemon.c b/src/src/daemon.c index bc33aec45..34786837a 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -290,7 +290,7 @@ if ((max_for_this_host > 0) && int other_host_count = 0; /* keep a count of non matches to optimise */ for (i = 0; i < smtp_accept_max; ++i) - if (smtp_slots[i].host_address != NULL) + if (smtp_slots[i].host_address) { if (Ustrcmp(sender_host_address, smtp_slots[i].host_address) == 0) host_accept_count++; @@ -842,13 +842,12 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) /* If it's a listening daemon for which we are keeping track of individual subprocesses, deal with an accepting process that has terminated. */ - if (smtp_slots != NULL) + if (smtp_slots) { for (i = 0; i < smtp_accept_max; i++) - { if (smtp_slots[i].pid == pid) { - if (smtp_slots[i].host_address != NULL) + if (smtp_slots[i].host_address) store_free(smtp_slots[i].host_address); smtp_slots[i] = empty_smtp_slot; if (--smtp_accept_count < 0) smtp_accept_count = 0; @@ -856,7 +855,6 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) smtp_accept_count, (smtp_accept_count == 1)? "" : "es"); break; } - } if (i < smtp_accept_max) continue; /* Found an accepting process */ } diff --git a/src/src/rda.c b/src/src/rda.c index 5df361e31..995909b09 100644 --- a/src/src/rda.c +++ b/src/src/rda.c @@ -806,22 +806,21 @@ if (read(fd, filtertype, sizeof(int)) != sizeof(int) || /* Read the contents of any syntax error blocks if we have a pointer */ -if (eblockp != NULL) +if (eblockp) { - uschar *s; error_block *e; - error_block **p = eblockp; - for (;;) + error_block **p; + for (p = eblockp; ; p = &e->next) { + uschar *s; if (!rda_read_string(fd, &s)) goto DISASTER; - if (s == NULL) break; + if (!s) break; e = store_get(sizeof(error_block)); e->next = NULL; e->text1 = s; if (!rda_read_string(fd, &s)) goto DISASTER; e->text2 = s; *p = e; - p = &(e->next); } } @@ -841,8 +840,7 @@ if (system_filtering) while (hn < n) { hn++; - h = h->next; - if (h == NULL) goto DISASTER_NO_HEADER; + if (!(h = h->next)) goto DISASTER_NO_HEADER; } h->type = htype_old; } @@ -852,7 +850,7 @@ if (system_filtering) uschar *s; int type; if (!rda_read_string(fd, &s)) goto DISASTER; - if (s == NULL) break; + if (!s) break; if (read(fd, &type, sizeof(type)) != sizeof(type)) goto DISASTER; header_add(type, "%s", s); } diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c index 2862111ab..59384420d 100644 --- a/src/src/tls-openssl.c +++ b/src/src/tls-openssl.c @@ -461,7 +461,7 @@ else if (rc < 0) { log_write(0, LOG_MAIN, "[%s] SSL verify error: internal error", - tlsp == &tls_out ? deliver_host_address : sender_host_address); + deliver_host_address); name = NULL; } break; diff --git a/test/src/server.c b/test/src/server.c index 26fcaf070..9d00300f1 100644 --- a/test/src/server.c +++ b/test/src/server.c @@ -52,6 +52,7 @@ on all interfaces, unless the option -noipv6 is given. */ #ifndef CS # define CS (char *) +# define CCS (const char *) #endif @@ -726,7 +727,7 @@ for (count = 0; count < connection_count; count++) alarm(0); n += offset; - printit(buffer, n); + printit(CS buffer, n); if (data) do { @@ -772,8 +773,10 @@ for (count = 0; count < connection_count; count++) } } - if (sscanf(buffer, "