Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/atari/stand/installboot Try to shrink binary size a...



details:   https://anonhg.NetBSD.org/src/rev/7e615359ee2d
branches:  trunk
changeset: 809960:7e615359ee2d
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Wed Aug 12 17:59:51 2015 +0000

description:
Try to shrink binary size a bit.

- omit usage of options in SMALLPROG case
- use bool instead of int where appropriate
- rely on zero-initialized-bss

diffstat:

 sys/arch/atari/stand/installboot/Makefile      |   4 ++--
 sys/arch/atari/stand/installboot/installboot.c |  23 +++++++++++++----------
 2 files changed, 15 insertions(+), 12 deletions(-)

diffs (82 lines):

diff -r 9234afe73c95 -r 7e615359ee2d sys/arch/atari/stand/installboot/Makefile
--- a/sys/arch/atari/stand/installboot/Makefile Wed Aug 12 17:53:03 2015 +0000
+++ b/sys/arch/atari/stand/installboot/Makefile Wed Aug 12 17:59:51 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.8 2014/11/24 08:08:23 tsutsui Exp $
+#      $NetBSD: Makefile,v 1.9 2015/08/12 17:59:51 tsutsui Exp $
 
 WARNS= 4
 PROG=  installboot
@@ -6,7 +6,7 @@
 SRCS=  installboot.c disklabel.c
 BINDIR=        /usr/mdec
 .ifndef SMALLPROG
-CPPFLAGS+=     -DCHECK_OS_BOOTVERSION
+CPPFLAGS+=     -DCHECK_OS_BOOTVERSION -DNO_USAGE
 LDADD= -lkvm
 .endif
 
diff -r 9234afe73c95 -r 7e615359ee2d sys/arch/atari/stand/installboot/installboot.c
--- a/sys/arch/atari/stand/installboot/installboot.c    Wed Aug 12 17:53:03 2015 +0000
+++ b/sys/arch/atari/stand/installboot/installboot.c    Wed Aug 12 17:59:51 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: installboot.c,v 1.34 2014/11/24 08:08:23 tsutsui Exp $ */
+/*     $NetBSD: installboot.c,v 1.35 2015/08/12 17:59:51 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1995 Waldi Ravens
@@ -73,23 +73,26 @@
 static const char      mdecpath[] = PATH_MDEC;
 static const char      stdpath[] = PATH_STD;
 static const char      milanpath[] = PATH_MILAN;
-static int             nowrite = 0;
-static int             verbose = 0;
-static int             trackpercyl = 0;
-static int             secpertrack = 0;
-static int             milan = 0;
+static bool            nowrite;
+static bool            verbose;
+static int             trackpercyl;
+static int             secpertrack;
+static bool            milan;
 
 static void
 usage(void)
 {
        fprintf(stderr,
                "usage: installboot [options] device\n"
+#ifndef NO_USAGE
                "where options are:\n"
                "\t-N  do not actually write anything on the disk\n"
                "\t-m  use Milan boot blocks\n"
                "\t-t  number of tracks per cylinder (IDE disk)\n"
                "\t-u  number of sectors per track (IDE disk)\n"
-               "\t-v  verbose mode\n");
+               "\t-v  verbose mode\n"
+#endif
+               );
        exit(EXIT_FAILURE);
 }
 
@@ -110,10 +113,10 @@
        while ((c = getopt(argc, argv, "Nmt:u:v")) != -1) {
                switch (c) {
                  case 'N':
-                       nowrite = 1;
+                       nowrite = true;
                        break;
                  case 'm':
-                       milan = 1;
+                       milan = true;
                        break;
                  case 't':
                        trackpercyl = atoi(optarg);
@@ -122,7 +125,7 @@
                        secpertrack = atoi(optarg);
                        break;
                  case 'v':
-                       verbose = 1;
+                       verbose = true;
                        break;
                  default:
                        usage();



Home | Main Index | Thread Index | Old Index