Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): revert C99 initializer in ApplyModifiers



details:   https://anonhg.NetBSD.org/src/rev/eee69ea09eee
branches:  trunk
changeset: 936956:eee69ea09eee
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 09 14:02:15 2020 +0000

description:
make(1): revert C99 initializer in ApplyModifiers

The code of usr.bin/make is supposed to be C90-compatible.  That's why
it neither uses line-end comments nor declaration-after-statement nor a
few other features.

The fields that were copied "by name" did not get any additional
comments, only the ones with literal values did, since it's hard to see
what these mean.

This style of initializer has the additional benefit that a missing or
extraneous initializer-item would lead to a compile-time error, rather
than going undetected.

diffstat:

 usr.bin/make/var.c |  24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diffs (51 lines):

diff -r 831b936d4f04 -r eee69ea09eee usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Aug 09 13:48:00 2020 +0000
+++ b/usr.bin/make/var.c        Sun Aug 09 14:02:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.442 2020/08/09 13:16:10 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.443 2020/08/09 14:02:15 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.442 2020/08/09 13:16:10 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.443 2020/08/09 14:02:15 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.442 2020/08/09 13:16:10 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.443 2020/08/09 14:02:15 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3004,18 +3004,12 @@
     void ** const freePtr      /* free this after using the return value */
 ) {
     ApplyModifiersState st = {
-       .startc = startc,
-       .endc = endc,
-       .v = v,
-       .ctxt = ctxt,
-       .eflags = eflags,
-       .val = val,
-       .newVal = NULL,
-       .missing_delim = '\0',
-       .sep = ' ',
-       .oneBigWord = FALSE
-    }
-    ;
+       startc, endc, v, ctxt, eflags, val,
+       NULL,                   /* .newVal */
+       '\0',                   /* .missing_delim */
+       ' ',                    /* .sep */
+       FALSE                   /* .oneBigWord */
+    };
     const char *p;
     const char *mod;
     ApplyModifierResult res;



Home | Main Index | Thread Index | Old Index