Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libwrap Whitespace (indent with tabs, rather than spaces...



details:   https://anonhg.NetBSD.org/src/rev/79466aa8d8dd
branches:  trunk
changeset: 838377:79466aa8d8dd
user:      kre <kre%NetBSD.org@localhost>
date:      Mon Jan 14 03:30:25 2019 +0000

description:
Whitespace (indent with tabs, rather than spaces), and rearrange one
line that needed wrapping so it no longer does, and is (IMO) clearer.
WHile here, note that this was created in 2019, not 2018, for the
copyright notice...

NFCI.

diffstat:

 lib/libwrap/expandm.c |  33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diffs (63 lines):

diff -r 37bfe6631f95 -r 79466aa8d8dd lib/libwrap/expandm.c
--- a/lib/libwrap/expandm.c     Mon Jan 14 00:23:43 2019 +0000
+++ b/lib/libwrap/expandm.c     Mon Jan 14 03:30:25 2019 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: expandm.c,v 1.7 2019/01/13 06:10:34 kre Exp $  */
+/*     $NetBSD: expandm.c,v 1.8 2019/01/14 03:30:25 kre Exp $  */
 
 /*-
- * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: expandm.c,v 1.7 2019/01/13 06:10:34 kre Exp $");
+__RCSID("$NetBSD: expandm.c,v 1.8 2019/01/14 03:30:25 kre Exp $");
 
 #include <limits.h>
 #include <stdio.h>
@@ -53,27 +53,26 @@
        char *buf, *m, *nbuf;
        const char *ptr;
 
-       for (ptr = fmt, buf = NULL; (m = strstr(ptr, "%m")) != NULL;
-           ptr = m + 2)
-       {
+       buf = NULL;
+       for (ptr = fmt; (m = strstr(ptr, "%m")) != NULL; ptr = m + 2) {
                size_t cnt = 0;
 
                for (char *p = m; p >= ptr && *p == '%'; p--)
                        cnt++;
 
-               if (__predict_false((m - ptr) >= INT_MAX)) {
-                        size_t blen = buf ? strlen(buf) : 0;
-                        size_t nlen = (size_t)(m - ptr);
+               if (__predict_false((m - ptr) >= INT_MAX)) {
+                       size_t blen = buf ? strlen(buf) : 0;
+                       size_t nlen = (size_t)(m - ptr);
 
-                        nbuf = realloc(buf, blen + nlen + 1);
-                        if (nbuf == NULL)
-                                goto out;
+                       nbuf = realloc(buf, blen + nlen + 1);
+                       if (nbuf == NULL)
+                               goto out;
 
-                        memcpy(nbuf + blen, ptr, nlen);
-                        nbuf[blen + nlen] = '\0';
-                        ptr += nlen;
-                        buf = nbuf;
-                }
+                       memcpy(nbuf + blen, ptr, nlen);
+                       nbuf[blen + nlen] = '\0';
+                       ptr += nlen;
+                       buf = nbuf;
+               }
 
                if (__predict_true(e == NULL && (cnt & 1) != 0))
                        e = strerror(err);



Home | Main Index | Thread Index | Old Index