From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2 for-4.5 1/2] libxl: un-constify return value of libxl_basename Date: Tue, 2 Dec 2014 18:44:50 +0000 Message-ID: <547E08A2.2030608@citrix.com> References: <1417433473-17272-1-git-send-email-wei.liu2@citrix.com> <1417433473-17272-2-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1417433473-17272-2-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu , xen-devel@lists.xen.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org On 01/12/14 11:31, Wei Liu wrote: > The string returned is malloc'ed but marked as "const". > > Signed-off-by: Wei Liu > Cc: Ian Campbell > Cc: Ian Jackson > --- > tools/libxl/libxl.h | 10 ++++++++++ > tools/libxl/libxl_utils.c | 5 ++++- > tools/libxl/libxl_utils.h | 6 +++++- > 3 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h > index 41d6e8d..291c190 100644 > --- a/tools/libxl/libxl.h > +++ b/tools/libxl/libxl.h > @@ -478,6 +478,16 @@ typedef struct libxl__ctx libxl_ctx; > #endif > > /* > + * LIBXL_HAVE_CONST_LIBXL_BASENAME_RETURN_VALUE > + * > + * The return value of libxl_basename is malloc'ed but the erroneously > + * marked as "const" in releases before 4.5. > + */ > +#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x040500 > +#define LIBXL_HAVE_CONST_LIBXL_BASENAME_RETURN_VALUE 1 > +#endif This define is currently useless. Only newer code is capable of making use of newly introduced LIBXL_HAVE_$FOO flags, and with its current arrangement, this flag is only exposed to code requesting an older API version. This instead needs to be LIBXL_HAVE_NONCONST_LIBXL_BASENAME_RETURN_VALUE which should be 1 for any API version >= 4.5 ~Andrew