[parted-devel] avoid printf, when easy to do

Otavio Salvador otavio at debian.org
Wed Feb 14 02:59:51 CET 2007


Jim Meyering <jim at meyering.net> writes:

> Here's a start.
> Favoring the lighter-weight FILE* output function is not a big deal,
> but does tend to make the code smaller and a little more robust.
>
> BTW, I noticed some inconsistency in spacing before function-call
> open parentheses, e.g.
>   printf (

I think this one is the right. Anyone disagree?

<...>
> -    printf(_("\nCommand History:\n"));
> +    fputs (_("\nCommand History:\n"), stdout);
<...>

Your proposed changes looks right but I do think we should provide a
method to make it easier?

For example the following code (I hadn't test this code)?

#v+
static void printp (...)
{
        va_list         va_args;
        
        va_start (va_args);
        fputs (va_args, stdout);
        va_end (va_args);
}
#v-

Using it, we could then do:

#v+
-    printf(_("\nCommand History:\n"));
+    printp (_("\nCommand History:\n"));
#v-

Comments?

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio at debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."



More information about the parted-devel mailing list