bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: *printf declarations in stdio.h?


From: Bruno Haible
Subject: Re: *printf declarations in stdio.h?
Date: Mon, 12 Mar 2007 23:19:28 +0100
User-agent: KMail/1.5.4

Simon Josefsson wrote:
> I haven't been paying attention to the *printf discussions, but
> looking at current CVS, shouldn't the vasprintf module use stdio.h for
> the prototypes?

Yes, you're right. Since, as Paul said, gnulib not only attempts to mimic
POSIX APIs but also glibc APIs, and glibc declares vasprintf() and asprintf()
in <stdio.h>, gnulib should do the same.

> 2007-03-12  Simon Josefsson  <address@hidden>
> 
>       * modules/vasprintf: Depend on stdio for prototypes, and remove
>       vasprintf.h.
> 
>       * lib/stdio_.h: Declare asprintf and vasprintf, from vasprintf.h.
> 
>       * lib/asprintf.c: Use stdio.h for prototypes.
>       * lib/vasprintf.c: Ditto.
> 
>       * lib/vasprintf.h: File removed.

Correct but a few things are missing:
  - While moving the declarations to <stdio.h>, you dropped the specification
    comments. They are essential.
  - While moving the declarations to <stdio.h>, you dropped the
    #if !HAVE_VASPRINTF. When an implementation has the functions and they
    work fine, we don't want to risk a compilation error due to redeclaration
    of system functions. The declarations should be skipped in this case.
  - The '# if REPLACE_VASPRINTF' needs to be turned into a test of an
    AC_SUBSTed variable, so that the generated stdio.h doesn't need a
    config.h.
  - After you settled on the changes to lib/stdio_.h, modules/stdio and
    m4/stdio_h.m4 need to be updated accordingly.
  - Also update the callers:
       fgrep '"vasprintf.h"' lib/*.c tests/*.c
    shows a few places to update.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]