[ovs-dev] [PATCH v2] util: New wrapper function ovs_vsnprintf().

Ben Pfaff blp at nicira.com
Thu Dec 19 21:57:25 UTC 2013


On Thu, Dec 19, 2013 at 11:44:54AM -0800, Saurabh Shah wrote:
> So that vsnprintf on windows has C99 like semantics.
> 
> Signed-off-by: Saurabh Shah <ssaurabh at nicira.com>

Doesn't snprintf() need the same treatment?  Is there a reason not to
handle it in the same patch?

With this patch applied, if I add a file lib/stdio.h with the
following contents:

    #if defined __need_FILE || defined __need___FILE
    /* Special invocation from within glibc. */
    #include_next <stdio.h>
    #elif !defined STDIO_H_WRAPPER
    #define STDIO_H_WRAPPER 1
    #include_next <stdio.h>

    #undef snprintf
    #define snprintf(...) ((void) snprintf(__VA_ARGS__))

    #undef vsnprintf
    #define vsnprintf(...) ((void) vsnprintf(__VA_ARGS__))

    #endif /* stdio.h wrapper */

then I get plenty of errors:

    ../lib/command-line.c: In function 'proctitle_set':
    ../lib/command-line.c:172:7: error: void value not ignored as it ought to be
    ../lib/vlandev.c: In function 'vlandev_dummy_add':
    ../lib/vlandev.c:318:5: error: void value not ignored as it ought to be
    ../lib/json.c: In function 'json_serialized_length':
    ../lib/json.c:1743:9: error: void value not ignored as it ought to be
    ../lib/json.c:1746:9: error: void value not ignored as it ought to be
    ../lib/match.c: In function 'match_format':
    ../lib/match.c:924:9: error: void value not ignored as it ought to be
    ../lib/socket-util.c: In function 'shorten_name_via_proc':
    ../lib/socket-util.c:377:9: error: void value not ignored as it ought to be
    ../lib/socket-util.c: In function 'shorten_name_via_symlink':
    ../lib/socket-util.c:418:13: error: void value not ignored as it ought to be
    ../lib/socket-util.c:433:13: error: void value not ignored as it ought to be



More information about the dev mailing list