summaryrefslogtreecommitdiff
path: root/include/libHX
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-05-16 16:33:18 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-05-16 16:33:18 +0200
commita1bdcfa3ca8af4ddb69ee57d716aa943cf3fe94a (patch)
treef99686bfde6b647ee0e61ae1ccb0e1c9d6ca00b5 /include/libHX
parent9ab517d65bbe24869c2c449a52eb17f572d1ac8d (diff)
New upstream version 3.25upstream/3.25
Diffstat (limited to 'include/libHX')
-rw-r--r--include/libHX/defs.h29
-rw-r--r--include/libHX/libxml_helper.h1
-rw-r--r--include/libHX/misc.h2
-rw-r--r--include/libHX/string.h6
4 files changed, 11 insertions, 27 deletions
diff --git a/include/libHX/defs.h b/include/libHX/defs.h
index 9ecdd32..1ace518 100644
--- a/include/libHX/defs.h
+++ b/include/libHX/defs.h
@@ -2,23 +2,14 @@
#define _LIBHX_DEFS_H 1
#ifdef __cplusplus
-# define FIELD_SIZEOF(type, member) \
- sizeof(static_cast<type *>(NULL)->member)
-# define HXsizeof_member(type, member) FIELD_SIZEOF(type, member)
-# define HXtypeof_member(type, member) \
- __typeof__(static_cast<type *>(NULL)->member)
-# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(offsetof)
- /*
- * This is here so most programs can skip inclusion
- * of stddef.h just to get offsetof.
- */
-# define offsetof(type, member) __builtin_offsetof(type, member)
-# endif
-# ifndef offsetof
-# define offsetof(type, member) \
- reinterpret_cast<long>(&(static_cast<type *>(NULL)->member))
+# define HXsizeof_member(type, member) sizeof(type::member)
+# if __cplusplus >= 201100L
+# define HXtypeof_member(type, member) decltype(type::member)
+# else
+# define HXtypeof_member(type, member) __typeof__(type::member))
# endif
# ifndef containerof
+# include <cstddef>
# define containerof(var, type, member) reinterpret_cast<type *>( \
reinterpret_cast<char *>(var) - offsetof(type, member))
# endif
@@ -139,14 +130,8 @@ static __inline__ new_type signed_cast(unsigned char *expr)
# ifndef reinterpret_cast
# define reinterpret_cast(type, expr) ((type)(expr))
# endif
-# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(offsetof)
-# define offsetof(type, member) __builtin_offsetof(type, member)
-# endif
-# ifndef offsetof
-# define offsetof(type, member) \
- reinterpret_cast(long, &(static_cast(type *, NULL)->member))
-# endif
# ifndef containerof
+# include <stddef.h>
# define containerof(var, type, member) reinterpret_cast(type *, \
reinterpret_cast(char *, var) - offsetof(type, member))
# endif
diff --git a/include/libHX/libxml_helper.h b/include/libHX/libxml_helper.h
index 599ede1..ebe5613 100644
--- a/include/libHX/libxml_helper.h
+++ b/include/libHX/libxml_helper.h
@@ -6,7 +6,6 @@
#else
# include <string.h>
#endif
-#include <libHX/defs.h>
#include <libxml/parser.h>
#ifdef __cplusplus
diff --git a/include/libHX/misc.h b/include/libHX/misc.h
index 3f68917..adebf22 100644
--- a/include/libHX/misc.h
+++ b/include/libHX/misc.h
@@ -11,8 +11,6 @@
# include <cstdarg>
# include <cstdio>
#endif
-#include <libHX/defs.h>
-#include <libHX/io.h>
#ifdef __cplusplus
extern "C" {
diff --git a/include/libHX/string.h b/include/libHX/string.h
index f7146b5..4dc4c11 100644
--- a/include/libHX/string.h
+++ b/include/libHX/string.h
@@ -66,8 +66,10 @@ extern char *HX_dirname(const char *);
extern hxmc_t *HX_getl(hxmc_t **, FILE *);
extern void *HX_memmem(const void *, size_t, const void *, size_t);
extern char **HX_split(const char *, const char *, int *, int);
-extern char **HX_split4(char *, const char *, int *, int);
-extern int HX_split5(char *, const char *, int, char **);
+extern int HX_split_fixed(char *, const char *, int, char **);
+extern char **HX_split_inplace(char *, const char *, int *, int);
+#define HX_split4(a, b, c, d) HX_split_inplace((a), (b), (c), (d))
+#define HX_split5(a, b, c, d) HX_split_fixed((a), (b), (c), (d))
extern char *HX_strbchr(const char *, const char *, char);
extern char *HX_strchr2(const char *, const char *);
extern char *HX_strclone(char **, const char *);