diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-11-23 07:00:08 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-11-23 07:00:08 +0000 |
commit | af7af769b97af63b70e38b607dc389d1b689e8bc (patch) | |
tree | 8186e2ec7f199bc8c98209b9ecf1c99f2ca34af2 /tools/libxl/libxl_osdeps.h | |
parent | c14ce8a1257fbbc43c4196b186a7677209c6b12e (diff) | |
download | xen-af7af769b97af63b70e38b607dc389d1b689e8bc.tar.gz xen-af7af769b97af63b70e38b607dc389d1b689e8bc.tar.bz2 xen-af7af769b97af63b70e38b607dc389d1b689e8bc.zip |
libxenlight: correct broken osdeps.[ch] and make #includes consistent
osdeps.[hc] previously mistakenly declared and defined [v]asprintf.
These functions are available in the libc on most platforms. Also,
osdeps.h is used by xc.c but xc.c is not part of the library, so
osdeps.h is part of the public interface and should have a better
name.
So now, instead:
* osdeps.h is libxl_osdeps.h.
* _GNU_SOURCE is #defined in libxl_osdeps.h so that we get the system
[v]asprintf (and various other functions)
* libxl_osdeps.h is included first in every libxl*.c file (it needs
to be before any system headers so that _GNU_SOURCE) takes effect.
* osdeps.[hc] only provide their own reimplementation of [v]asprintf
if NEED_OWN_ASPRINTF is defined. Currently it is not ever defined
but this is provided for any platform which needs it.
* While I was editing the #includes in each .c file, I put them all
into the same order: "libxl_osdeps.h", then system headers,
then local headers.
* xs.h is included in libxl.h. This is needed for "bool"; it has to
not be typedefed in libxl.h because otherwise we get a duplicate
definition when including xs.h.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_osdeps.h')
-rw-r--r-- | tools/libxl/libxl_osdeps.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/libxl/libxl_osdeps.h b/tools/libxl/libxl_osdeps.h new file mode 100644 index 0000000000..fc453c3553 --- /dev/null +++ b/tools/libxl/libxl_osdeps.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2009 Citrix Ltd. + * Author Stefano Stabellini <stefano.stabellini@eu.citrix.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking described in file LICENSE. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +/* + * This header must be included first, before any system headers, + * so that _GNU_SOURCE takes effect properly. + */ + +#ifndef LIBXL_OSDEP +#define LIBXL_OSDEP + +#define _GNU_SOURCE + +#ifdef NEED_OWN_ASPRINTF +#include <stdarg.h> + +int asprintf(char **buffer, char *fmt, ...); +int vasprintf(char **buffer, const char *fmt, va_list ap); +#endif /*NEED_OWN_ASPRINTF*/ + +#endif |