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

Jim Meyering jim at meyering.net
Wed Mar 7 20:49:02 CET 2007


"Debarshi 'Rishi' Ray" <debarshi.ray at gmail.com> wrote:

> Some more printf-like functions replaced by fputs, puts and putchar. I
> have tried to avoid any re-formatting than what was absolutely
> necessary to preserve the formatting of the code after making the
> changes.
>
> Comments?

Overall looks good.
However, there's one typo (added "v").

I'm ambivalent about using "puts" (which you've done correctly)
because of it's somewhat "hidden" semantics of adding a trailing newline.
Sometimes it's more maintainer/translator-friendly to use fputs and
include an explicit "\n" at the end of the literal string, in spite of
the need for the added stdout or stderr argument.

...
> diff --git a/libparted/fs/ext2/ext2_resize.c b/libparted/fs/ext2/ext2_resize.c
> index faea7e3..960e54a 100644
> --- a/libparted/fs/ext2/ext2_resize.c
> +++ b/libparted/fs/ext2/ext2_resize.c
> @@ -18,7 +18,7 @@
>  */
>
>  #include <config.h>
> -
> +v

Typo?

>  #ifndef DISCOVER_ONLY
...
> diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c
> index 028f8b0..5898573 100644
...
> -		printf("BUG: no free FMT5 DSCB extent found!\nexiting...\n");
> +		puts ("BUG: no free FMT5 DSCB extent found!\nexiting...");



More information about the parted-devel mailing list