On Sun, 15 Jan 2012 at 17:30:22 +0000, Carlos R. Mafra wrote:
> On Sun, 15 Jan 2012 at 18:10:16 +0100, [email protected] wrote:
> > 
> > In patch 5/6, I'd guess there's a little mistake for the 'exit', I
> > think it should be placed after the "if (ThemePath)" and not inside to
> > keep the original behaviour which is probably expected, please see
> > below if not clear.
> 
> Thanks a lot for the review, and indeed you're right. 
> 
> I will update the patch. I haven't pushed to the repo yet and will 
> wait some more.

>From 0857432164af0e10e15037047cda9974a2b4d484 Mon Sep 17 00:00:00 2001
From: Carlos R. Mafra <[email protected]>
Date: Sun, 15 Jan 2012 13:22:18 +0000
Subject: [PATCH 1/2] getstyle: Get rid of abortar()

Instead of using a temporary buffer to store a "reason" string
which is later printf()'ed by abortar(), use wwarning() directly
and do the small cleanup done by abortar() on the spot.

As this was the only call site for abortar() it can now be removed.
The resulting object code gets smaller as a side effect.

Thanks to Christophe <[email protected]> for finding a mistake
in the first version of this patch.

Signed-off-by: Carlos R. Mafra <[email protected]>
---
 util/getstyle.c |   18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/util/getstyle.c b/util/getstyle.c
index 3932962..6230b51 100644
--- a/util/getstyle.c
+++ b/util/getstyle.c
@@ -148,16 +148,6 @@ void print_help(int print_usage, int exitval)
        exit(exitval);
 }
 
-void abortar(char *reason)
-{
-       printf("%s: %s\n", __progname, reason);
-       if (ThemePath) {
-               printf("Removing unfinished theme pack\n");
-               (void)wrmdirhier(ThemePath);
-       }
-       exit(1);
-}
-
 static Bool isFontOption(char *option)
 {
        int i;
@@ -177,10 +167,10 @@ void findCopyFile(char *dir, char *file)
 
        fullPath = wfindfileinarray(PixmapPath, file);
        if (!fullPath) {
-               char buffer[4000];
-
-               sprintf(buffer, "could not find file %s", file);
-               abortar(buffer);
+               wwarning("Could not find file %s", file);
+               if (ThemePath)
+                       (void)wrmdirhier(ThemePath);
+               exit(1);
        }
        copy_file(dir, fullPath, fullPath);
        free(fullPath);
-- 
1.7.3.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to