[PATCH:listres] Replace computed printf format string with static string

Alan Coopersmith alan.coopersmith at oracle.com
Fri Feb 10 19:33:38 PST 2012


Allows format string analysis by gcc & other code checkers.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 listres.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/listres.c b/listres.c
index c566201..2317473 100644
--- a/listres.c
+++ b/listres.c
@@ -150,15 +150,13 @@ static void list_known_widgets (void)
     int i;
     XmuWidgetNode *wn;
     int width = 0;
-    char format[20];
 
     for (i = 0, wn = widget_list; i < nwidgets; i++, wn++) {
 	int l = strlen (wn->label);
 	if (l > width) width = l;
     }
-    sprintf (format, "%%-%ds  ", width);
     for (i = 0, wn = widget_list; i < nwidgets; i++, wn++) {
-	printf (format, wn->label);
+	printf ("%-*s  ", width, wn->label);
 	print_classname (wn, (XmuWidgetNode *) NULL, 0, False);
 	putchar ('\n');
     }
-- 
1.7.3.2



More information about the xorg-devel mailing list