Roman Divacky <rdiva...@freebsd.org> wrote:

> this diet patch 
> 
>         http://lev.vlakno.cz/~rdivacky/boot2-final-diet.patch
> 
> includes these changes:
> 
>         o       bunch of variables are turned into uint8_t 
> 
>         o       initial setting of namep[] in lookup() is removed
>                 as it's only overwritten a few lines down
> 
>         o       kname is explicitly initialized in main() as BSS
>                 in boot2 is not zeroed

Are you saying the previous:

static const char *kname = NULL;

didn't work, or is this the explanation why the
initialization hasn't simply been removed?

>         o       the "fmt" dance in load() is removed
> 
>         o       buf in printf() is made static to save space
> 
> 
> Please test/review this patch. John Baldwin already looked and I booted
> it so it should be quite safe. I plan to commit this in a few days unless
> problems are found..

Works for me with gcc from base on amd64.


I noticed an unrelated warning about an unused variable, though.

/usr/src/sys/boot/i386/boot2/boot2.c: In function 'load':
/usr/src/sys/boot/i386/boot2/boot2.c:310: warning: unused variable 'x'

It seems to be left over from:
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/boot/i386/boot2/boot2.c.diff?r1=1.91;r2=1.92;f=h

The attached (only compile-tested) patch removes it.

Fabian
From 92e87c9a0daf786790ed1f50143a428f2df5ad97 Mon Sep 17 00:00:00 2001
From: Fabian Keil <f...@fabiankeil.de>
Date: Tue, 8 Mar 2011 20:59:20 +0100
Subject: [PATCH] Remove unused variable x in load()

---
 sys/boot/i386/boot2/boot2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c
index 5cdb818..a0aa3f1 100644
--- a/sys/boot/i386/boot2/boot2.c
+++ b/sys/boot/i386/boot2/boot2.c
@@ -307,7 +307,7 @@ load(void)
     static Elf32_Shdr es[2];
     caddr_t p;
     ino_t ino;
-    uint32_t addr, x;
+    uint32_t addr;
     int i, j;
 
     if (!(ino = lookup(kname))) {
-- 
1.7.4.1

Attachment: signature.asc
Description: PGP signature

Reply via email to