Hi.
Here is a rewriting of patch submitted, which I find better.
First, declare 'len' as size_t (strlen() returns size_t, not int, and we must be
carefull when comparing unsigned and int).
Do not use printf(), cause there is no need for formatted output, so that
fputs is faster and simpler (easier to catch with prototypes).

And another small cleanup (no need for calling printf() twice, we can join
them in the same format string).


Cheers,
diff -ur xine-ui-0.99.4/src/xitk/main.c xine-ui-0.99.4.new/src/xitk/main.c
--- xine-ui-0.99.4/src/xitk/main.c      2005-07-24 04:40:37.000000000 +0200
+++ xine-ui-0.99.4.new/src/xitk/main.c  2006-06-20 12:44:27.000000000 +0200
@@ -453,24 +453,22 @@
 static void print_formatted(char *title, const char *const *plugins) {
   const char  *plugin;
   char         buffer[81];
-  int          len;
+  size_t       len;
   char        *blanks = "     ";
 
-  printf(title);
+  fputs(title, stdout);
   
   sprintf(buffer, "%s", blanks);
   plugin = *plugins++;
   
   while(plugin) {
-    
     len = strlen(buffer);
     
-    if((len + (strlen(plugin) + 3)) < 80) {
+    if(((int)(len + strlen(plugin)) + 3) < 80) {
       sprintf(buffer, "%s%s%s", buffer, (strlen(buffer) == strlen(blanks)) ? 
"" : ", ", plugin);
     }
     else {
-      printf(buffer);
-      printf(",\n");
+      printf("%s,\n", buffer);
       snprintf(buffer, sizeof(buffer), "%s%s", blanks, plugin);
     }
     
@@ -478,9 +476,9 @@
   }
   
   if(strlen(buffer))
-    printf(buffer);
+    fputs(buffer, stdout);
   
-  printf(".\n\n");
+  puts(".\n");
 }
 static void list_plugins(char *type) {
   typedef struct {
diff -ur xine-ui-0.99.4/src/xitk/xine-toolkit/xitk.c 
xine-ui-0.99.4.new/src/xitk/xine-toolkit/xitk.c
--- xine-ui-0.99.4/src/xitk/xine-toolkit/xitk.c 2005-05-21 00:02:05.000000000 
+0200
+++ xine-ui-0.99.4.new/src/xitk/xine-toolkit/xitk.c     2006-06-20 
12:28:22.000000000 +0200
@@ -1877,7 +1877,7 @@
   sprintf(buffer, "%s%s", buffer, " ]-");
 
   if(verbosity)
-    printf(buffer);
+    fputs(buffer, stdout);
 
   gXitk->wm_type = xitk_check_wm(display);
   

Reply via email to