libxl: un-constify return value of libxl_basename

The string returned is malloc'ed but marked as "const".

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
Wei Liu authored and Ian Campbell committed 2014-12-02 13:55:28 +00:00
1 parent e609bb983e
commit e3abab7459
3 files changed
+19 -2

No files matched your search

+10
View File
@@ -477,6 +477,16 @@ typedef struct libxl__ctx libxl_ctx;
#define LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG 1
#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
/*
* LIBXL_HAVE_PHYSINFO_OUTSTANDING_PAGES
*
+4 -1
View File
@@ -19,7 +19,10 @@
#include "libxl_internal.h"
const char *libxl_basename(const char *name)
#ifdef LIBXL_HAVE_CONST_LIBXL_BASENAME_RETURN_VALUE
const
#endif
char *libxl_basename(const char *name)
{
const char *filename;
if (name == NULL)
+5 -1
View File
@@ -18,7 +18,11 @@
#include "libxl.h"
const char *libxl_basename(const char *name); /* returns string from strdup */
#ifdef LIBXL_HAVE_CONST_LIBXL_BASENAME_RETURN_VALUE
const
#endif
char *libxl_basename(const char *name); /* returns string from strdup */
unsigned long libxl_get_required_shadow_memory(unsigned long maxmem_kb, unsigned int smp_cpus);
int libxl_name_to_domid(libxl_ctx *ctx, const char *name, uint32_t *domid);
int libxl_domain_qualifier_to_domid(libxl_ctx *ctx, const char *name, uint32_t *domid);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.