mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
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:
1 parent
e609bb983e
commit
e3abab7459
3 files changed
+19
-2
No files matched your search
@@ -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
|
||||
*
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||