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 RFC v2 01/13] libxl: Make libxl__xs_* more const-

To: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH RFC v2 01/13] libxl: Make libxl__xs_* more const-correct
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Mon, 31 Oct 2011 09:34:41 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 31 Oct 2011 02:36:52 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1319827031-15395-2-git-send-email-ian.jackson@xxxxxxxxxxxxx>
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>
Organization: Citrix Systems, Inc.
References: <1319827031-15395-1-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1319827031-15395-2-git-send-email-ian.jackson@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, 2011-10-28 at 19:36 +0100, Ian Jackson wrote:
> Paths and values which are not modified by these functions should be
> declared as "const char *" not "char *".
> 
> Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

Obviously correct, (assuming it compiles, which is a safe assumption I
think ;-))):

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>


> ---
>  tools/libxl/libxl_internal.h |    9 +++++----
>  tools/libxl/libxl_xshelp.c   |    9 +++++----
>  2 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 2e26ac6..31adbc8 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -181,18 +181,19 @@ _hidden char *libxl__dirname(libxl__gc *gc, const char 
> *s);
>  _hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, 
> int length);
>  
>  _hidden int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t,
> -                    char *dir, char **kvs);
> +                             const char *dir, char **kvs);
>  _hidden int libxl__xs_write(libxl__gc *gc, xs_transaction_t t,
> -                   char *path, const char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
> +               const char *path, const char *fmt, ...) PRINTF_ATTRIBUTE(4, 
> 5);
>     /* Each fn returns 0 on success.
>      * On error: returns -1, sets errno (no logging) */
>  
>  _hidden char *libxl__xs_get_dompath(libxl__gc *gc, uint32_t domid);
>     /* On error: logs, returns NULL, sets errno. */
>  
> -_hidden char *libxl__xs_read(libxl__gc *gc, xs_transaction_t t, char *path);
> +_hidden char *libxl__xs_read(libxl__gc *gc, xs_transaction_t t,
> +                             const char *path);
>  _hidden char **libxl__xs_directory(libxl__gc *gc, xs_transaction_t t,
> -                                   char *path, unsigned int *nb);
> +                                   const char *path, unsigned int *nb);
>     /* On error: returns NULL, sets errno (no logging) */
>  
>  /* from xl_dom */
> diff --git a/tools/libxl/libxl_xshelp.c b/tools/libxl/libxl_xshelp.c
> index e41f962..56a7c7b 100644
> --- a/tools/libxl/libxl_xshelp.c
> +++ b/tools/libxl/libxl_xshelp.c
> @@ -49,7 +49,7 @@ char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, 
> flexarray_t *array, int length)
>  }
>  
>  int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t,
> -                    char *dir, char *kvs[])
> +                     const char *dir, char *kvs[])
>  {
>      libxl_ctx *ctx = libxl__gc_owner(gc);
>      char *path;
> @@ -69,7 +69,7 @@ int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t,
>  }
>  
>  int libxl__xs_write(libxl__gc *gc, xs_transaction_t t,
> -                   char *path, const char *fmt, ...)
> +                    const char *path, const char *fmt, ...)
>  {
>      libxl_ctx *ctx = libxl__gc_owner(gc);
>      char *s;
> @@ -87,7 +87,7 @@ int libxl__xs_write(libxl__gc *gc, xs_transaction_t t,
>      return 0;
>  }
>  
> -char * libxl__xs_read(libxl__gc *gc, xs_transaction_t t, char *path)
> +char * libxl__xs_read(libxl__gc *gc, xs_transaction_t t, const char *path)
>  {
>      libxl_ctx *ctx = libxl__gc_owner(gc);
>      char *ptr;
> @@ -113,7 +113,8 @@ char *libxl__xs_get_dompath(libxl__gc *gc, uint32_t domid)
>      return s;
>  }
>  
> -char **libxl__xs_directory(libxl__gc *gc, xs_transaction_t t, char *path, 
> unsigned int *nb)
> +char **libxl__xs_directory(libxl__gc *gc, xs_transaction_t t,
> +                           const char *path, unsigned int *nb)
>  {
>      libxl_ctx *ctx = libxl__gc_owner(gc);
>      char **ret = NULL;



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