From: Ralph Corderoy Date: Sun, 23 Oct 2016 23:03:48 +0000 (+0100) Subject: Use LEN() to save having to consider the -1. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/dcf4ca6104c1085214bc110f0bb636fed0f64019?ds=sidebyside Use LEN() to save having to consider the -1. --- diff --git a/uip/popsbr.c b/uip/popsbr.c index 8d2cf9d7..54aa3684 100644 --- a/uip/popsbr.c +++ b/uip/popsbr.c @@ -15,7 +15,6 @@ #include #define TRM "." -#define TRMLEN (sizeof TRM - 1) static int poprint = 0; @@ -686,14 +685,14 @@ vcommand (const char *fmt, va_list ap) int multiline (void) { - char buffer[BUFSIZ + TRMLEN]; + char buffer[BUFSIZ + LEN(TRM)]; if (pop_getline (buffer, sizeof buffer, nsc) != OK) return NOTOK; if (HasPrefix(buffer, TRM)) { - if (buffer[TRMLEN] == 0) + if (buffer[LEN(TRM)] == 0) return DONE; - strncpy (response, buffer + TRMLEN, sizeof(response)); + strncpy (response, buffer + LEN(TRM), sizeof(response)); } else strncpy (response, buffer, sizeof(response));