WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] mini-os: make xenbus_read_integer and xenbus_pri

To: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH] mini-os: make xenbus_read_integer and xenbus_printf take const strings
From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Date: Tue, 26 Aug 2008 17:34:37 +0100
Cc:
Delivery-date: Tue, 26 Aug 2008 09:37:02 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20080826161702.GB4555@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20080826161702.GB4555@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Reply-to: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
On Tue, Aug 26, 2008 at 05:17:02PM +0100, Samuel Thibault wrote:
> mini-os: make xenbus_read_integer and xenbus_printf take const strings
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
> 
> diff -r c2472ded5c7c extras/mini-os/include/xenbus.h
> --- a/extras/mini-os/include/xenbus.h Tue Aug 26 15:16:57 2008 +0100
> +++ b/extras/mini-os/include/xenbus.h Tue Aug 26 17:06:09 2008 +0100
> @@ -83,12 +83,12 @@ char *xenbus_transaction_end(xenbus_tran
>                            int *retry);
>  
>  /* Read path and parse it as an integer.  Returns -1 on error. */
> -int xenbus_read_integer(char *path);
> +int xenbus_read_integer(const char *path);
>  
>  /* Contraction of snprintf and xenbus_write(path/node). */
>  char* xenbus_printf(xenbus_transaction_t xbt,
> -                                  char* node, char* path,
> -                                  char* fmt, ...);
> +                                  const char* node, const char* path,
> +                                  const char* fmt, ...);

If you annotate that declaration with

   __attribute__ ((__format__ (printf, 4, 3)))

then gcc will warn you any time a caller gives incorrect args vs
format string, which can catch some otherwise hidden bugs.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>