[Libvir] sexpr_get: add __printf__ attribute

Richard W.M. Jones rjones at redhat.com
Wed Oct 17 10:26:55 UTC 2007


Jim Meyering wrote:
> I noticed sexpr_get takes a printf-style format,
> yet it is declared with no printf attribute.  Here's the fix:
> 
> 2007-10-17  Jim Meyering  <meyering at redhat.com>
> 
> 	* src/xend_internal.c (sexpr_get): Declare with gcc's printf attribute.
> 
> Index: src/xend_internal.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/xend_internal.c,v
> retrieving revision 1.148
> diff -u -p -r1.148 xend_internal.c
> --- src/xend_internal.c	15 Oct 2007 21:38:56 -0000	1.148
> +++ src/xend_internal.c	17 Oct 2007 08:29:26 -0000
> @@ -692,6 +692,10 @@ xend_op(virConnectPtr xend, const char *
>   */
>  static struct sexpr *
>  sexpr_get(virConnectPtr xend, const char *fmt, ...)
> +  __attribute__ ((__format__ (__printf__, 2, 3)));
> +
> +static struct sexpr *
> +sexpr_get(virConnectPtr xend, const char *fmt, ...)
>  {
>      char buffer[4096];
>      char path[1024];

I changed it to use the ATTRIBUTE_FORMAT macro (expands to nothing on 
non-GCC), and committed it.

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071017/81c94ea3/attachment-0001.bin>


More information about the libvir-list mailing list