ctype_helper.h | ctype_helper.h | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
* and thus knowingly make it impossible to pass in stdio's "EOF" (-1). | * and thus knowingly make it impossible to pass in stdio's "EOF" (-1). | |||
* [When was the last time you did a isalpha(EOF) anyway?] | * [When was the last time you did a isalpha(EOF) anyway?] | |||
* | * | |||
* Because, again, this all works due to implicit type conversion, these | * Because, again, this all works due to implicit type conversion, these | |||
* wrappers look rather plain. Oh, also note we are returning the much | * wrappers look rather plain. Oh, also note we are returning the much | |||
* more modern "bool". | * more modern "bool". | |||
* | * | |||
* And not all ctype functions are provided - no need so far, and I do not | * And not all ctype functions are provided - no need so far, and I do not | |||
* want to clutter it before needing it. | * want to clutter it before needing it. | |||
*/ | */ | |||
static inline bool HX_isalnum(unsigned char c) | static __inline__ bool HX_isalnum(unsigned char c) | |||
{ | { | |||
return isalnum(c); | return isalnum(c); | |||
} | } | |||
static inline bool HX_isalpha(unsigned char c) | static __inline__ bool HX_isalpha(unsigned char c) | |||
{ | { | |||
return isalpha(c); | return isalpha(c); | |||
} | } | |||
static inline bool HX_isdigit(unsigned char c) | static __inline__ bool HX_isdigit(unsigned char c) | |||
{ | { | |||
return isdigit(c); | return isdigit(c); | |||
} | } | |||
static inline bool HX_islower(unsigned char c) | static __inline__ bool HX_islower(unsigned char c) | |||
{ | { | |||
return islower(c); | return islower(c); | |||
} | } | |||
static inline bool HX_isprint(unsigned char c) | static __inline__ bool HX_isprint(unsigned char c) | |||
{ | { | |||
return isprint(c); | return isprint(c); | |||
} | } | |||
static inline bool HX_isspace(unsigned char c) | static __inline__ bool HX_isspace(unsigned char c) | |||
{ | { | |||
return isspace(c); | return isspace(c); | |||
} | } | |||
static inline bool HX_isupper(unsigned char c) | static __inline__ bool HX_isupper(unsigned char c) | |||
{ | { | |||
return isupper(c); | return isupper(c); | |||
} | } | |||
static inline bool HX_isxdigit(unsigned char c) | static __inline__ bool HX_isxdigit(unsigned char c) | |||
{ | { | |||
return isxdigit(c); | return isxdigit(c); | |||
} | } | |||
static inline unsigned char HX_tolower(unsigned char c) | static __inline__ unsigned char HX_tolower(unsigned char c) | |||
{ | { | |||
return tolower(c); | return tolower(c); | |||
} | } | |||
static inline unsigned char HX_toupper(unsigned char c) | static __inline__ unsigned char HX_toupper(unsigned char c) | |||
{ | { | |||
return toupper(c); | return toupper(c); | |||
} | } | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} /* extern "C" */ | } /* extern "C" */ | |||
#endif | #endif | |||
#endif /* _LIBHX_CTYPE_H */ | #endif /* _LIBHX_CTYPE_H */ | |||
End of changes. 10 change blocks. | ||||
10 lines changed or deleted | 10 lines changed or added | |||
defs.h | defs.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
# ifndef offsetof | # ifndef offsetof | |||
# define offsetof(type, member) \ | # define offsetof(type, member) \ | |||
reinterpret_cast<long>(&(static_cast<type *>(NULL)-> member)) | reinterpret_cast<long>(&(static_cast<type *>(NULL)-> member)) | |||
# endif | # endif | |||
# ifndef containerof | # ifndef containerof | |||
# define containerof(var, type, member) reinterpret_cast<type *>( \ | # define containerof(var, type, member) reinterpret_cast<type *>( \ | |||
reinterpret_cast<char *>(var) - offsetof(type, membe r)) | reinterpret_cast<char *>(var) - offsetof(type, membe r)) | |||
# endif | # endif | |||
template<typename new_type> | template<typename new_type> | |||
static inline new_type signed_cast(const char *expr) | static __inline__ new_type signed_cast(const char *expr) | |||
{ | { | |||
return reinterpret_cast<new_type>(expr); | return reinterpret_cast<new_type>(expr); | |||
} | } | |||
template<typename new_type> | template<typename new_type> | |||
static inline new_type signed_cast(const signed char *expr) | static __inline__ new_type signed_cast(const signed char *expr) | |||
{ | { | |||
return reinterpret_cast<new_type>(expr); | return reinterpret_cast<new_type>(expr); | |||
} | } | |||
template<typename new_type> | template<typename new_type> | |||
static inline new_type signed_cast(const unsigned char *expr) | static __inline__ new_type signed_cast(const unsigned char *expr) | |||
{ | { | |||
return reinterpret_cast<new_type>(expr); | return reinterpret_cast<new_type>(expr); | |||
} | } | |||
template<typename new_type> | template<typename new_type> | |||
static inline new_type signed_cast(char *expr) | static __inline__ new_type signed_cast(char *expr) | |||
{ | { | |||
return reinterpret_cast<new_type>(expr); | return reinterpret_cast<new_type>(expr); | |||
} | } | |||
template<typename new_type> | template<typename new_type> | |||
static inline new_type signed_cast(signed char *expr) | static __inline__ new_type signed_cast(signed char *expr) | |||
{ | { | |||
return reinterpret_cast<new_type>(expr); | return reinterpret_cast<new_type>(expr); | |||
} | } | |||
template<typename new_type> | template<typename new_type> | |||
static inline new_type signed_cast(unsigned char *expr) | static __inline__ new_type signed_cast(unsigned char *expr) | |||
{ | { | |||
return reinterpret_cast<new_type>(expr); | return reinterpret_cast<new_type>(expr); | |||
} | } | |||
#else | #else | |||
# define HXsizeof_member(type, member) sizeof(((type *)NULL)->member) | # define HXsizeof_member(type, member) sizeof(((type *)NULL)->member) | |||
# define HXtypeof_member(type, member) __typeof__(((type *)NULL)->memb er) | # define HXtypeof_member(type, member) __typeof__(((type *)NULL)->memb er) | |||
/* N.B. signed_cast<> does not exist in C++. */ | /* N.B. signed_cast<> does not exist in C++. */ | |||
# define __signed_cast_compatible(a, b) \ | # define __signed_cast_compatible(a, b) \ | |||
__builtin_choose_expr( \ | __builtin_choose_expr( \ | |||
__builtin_types_compatible_p(b, const char *) || \ | __builtin_types_compatible_p(b, const char *) || \ | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
deque.h | deque.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
extern void *HXdeque_pop(struct HXdeque *); | extern void *HXdeque_pop(struct HXdeque *); | |||
extern void *HXdeque_shift(struct HXdeque *); | extern void *HXdeque_shift(struct HXdeque *); | |||
extern void HXdeque_move(struct HXdeque_node *, struct HXdeque_node *); | extern void HXdeque_move(struct HXdeque_node *, struct HXdeque_node *); | |||
extern struct HXdeque_node *HXdeque_find(struct HXdeque *, const void *); | extern struct HXdeque_node *HXdeque_find(struct HXdeque *, const void *); | |||
extern void *HXdeque_get(struct HXdeque *, const void *); | extern void *HXdeque_get(struct HXdeque *, const void *); | |||
extern void *HXdeque_del(struct HXdeque_node *); | extern void *HXdeque_del(struct HXdeque_node *); | |||
extern void HXdeque_free(struct HXdeque *); | extern void HXdeque_free(struct HXdeque *); | |||
extern void HXdeque_genocide2(struct HXdeque *, void (*)(void *)); | extern void HXdeque_genocide2(struct HXdeque *, void (*)(void *)); | |||
extern void **HXdeque_to_vec(const struct HXdeque *, unsigned int *); | extern void **HXdeque_to_vec(const struct HXdeque *, unsigned int *); | |||
static inline void HXdeque_genocide(struct HXdeque *dq) | static __inline__ void HXdeque_genocide(struct HXdeque *dq) | |||
{ | { | |||
HXdeque_genocide2(dq, free); | HXdeque_genocide2(dq, free); | |||
} | } | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} /* extern "C" */ | } /* extern "C" */ | |||
extern "C++" { | extern "C++" { | |||
template<typename type> static inline type HXdeque_pop(struct HXdeque *dq) | template<typename type> static __inline__ type HXdeque_pop(struct HXdeque * dq) | |||
{ | { | |||
return reinterpret_cast<type>(HXdeque_pop(dq)); | return reinterpret_cast<type>(HXdeque_pop(dq)); | |||
} | } | |||
template<typename type> static inline type HXdeque_shift(struct HXdeque *dq | template<typename type> static __inline__ type | |||
) | HXdeque_shift(struct HXdeque *dq) | |||
{ | { | |||
return reinterpret_cast<type>(HXdeque_shift(dq)); | return reinterpret_cast<type>(HXdeque_shift(dq)); | |||
} | } | |||
template<typename type> static inline type | template<typename type> static __inline__ type | |||
HXdeque_get(struct HXdeque *dq, const void *ptr) | HXdeque_get(struct HXdeque *dq, const void *ptr) | |||
{ | { | |||
return reinterpret_cast<type>(HXdeque_get(dq, ptr)); | return reinterpret_cast<type>(HXdeque_get(dq, ptr)); | |||
} | } | |||
template<typename type> static inline type | template<typename type> static __inline__ type | |||
HXdeque_del(struct HXdeque_node *nd) | HXdeque_del(struct HXdeque_node *nd) | |||
{ | { | |||
return reinterpret_cast<type>(HXdeque_del(nd)); | return reinterpret_cast<type>(HXdeque_del(nd)); | |||
} | } | |||
template<typename type> static inline type * | template<typename type> static __inline__ type * | |||
HXdeque_to_vec(struct HXdeque *dq, unsigned int *n) | HXdeque_to_vec(struct HXdeque *dq, unsigned int *n) | |||
{ | { | |||
return reinterpret_cast<type *>(HXdeque_to_vec(dq, n)); | return reinterpret_cast<type *>(HXdeque_to_vec(dq, n)); | |||
} | } | |||
} /* extern "C++" */ | } /* extern "C++" */ | |||
#endif | #endif | |||
#endif /* _LIBHX_DEQUE_H */ | #endif /* _LIBHX_DEQUE_H */ | |||
End of changes. 6 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
libxml_helper.h | libxml_helper.h | |||
---|---|---|---|---|
skipping to change at line 16 | skipping to change at line 16 | |||
#else | #else | |||
# include <string.h> | # include <string.h> | |||
#endif | #endif | |||
#include <libHX/defs.h> | #include <libHX/defs.h> | |||
#include <libxml/parser.h> | #include <libxml/parser.h> | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
static inline int xml_strcmp(const xmlChar *a, const char *b) | static __inline__ int xml_strcmp(const xmlChar *a, const char *b) | |||
{ | { | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
return strcmp(signed_cast<const char *>(a), b); | return strcmp(signed_cast<const char *>(a), b); | |||
#else | #else | |||
return strcmp(signed_cast(const char *, a), b); | return strcmp(signed_cast(const char *, a), b); | |||
#endif | #endif | |||
} | } | |||
static inline int xml_strcasecmp(const xmlChar *a, const char *b) | static __inline__ int xml_strcasecmp(const xmlChar *a, const char *b) | |||
{ | { | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
return strcasecmp(signed_cast<const char *>(a), b); | return strcasecmp(signed_cast<const char *>(a), b); | |||
#else | #else | |||
return strcasecmp(signed_cast(const char *, a), b); | return strcasecmp(signed_cast(const char *, a), b); | |||
#endif | #endif | |||
} | } | |||
static inline char *xml_getprop(xmlNode *node, const char *attr) | static __inline__ char *xml_getprop(xmlNode *node, const char *attr) | |||
{ | { | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
return signed_cast<char *>(xmlGetProp(node, | return signed_cast<char *>(xmlGetProp(node, | |||
signed_cast<const xmlChar *>(attr))); | signed_cast<const xmlChar *>(attr))); | |||
#else | #else | |||
return signed_cast(char *, xmlGetProp(node, | return signed_cast(char *, xmlGetProp(node, | |||
signed_cast(const xmlChar *, attr))); | signed_cast(const xmlChar *, attr))); | |||
#endif | #endif | |||
} | } | |||
static inline xmlAttr *xml_newprop(xmlNode *node, const char *name, | static __inline__ xmlAttr * | |||
const char *value) | xml_newprop(xmlNode *node, const char *name, const char *value) | |||
{ | { | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
return xmlNewProp(node, signed_cast<const xmlChar *>(name), | return xmlNewProp(node, signed_cast<const xmlChar *>(name), | |||
signed_cast<const xmlChar *>(value)); | signed_cast<const xmlChar *>(value)); | |||
#else | #else | |||
return xmlNewProp(node, signed_cast(const xmlChar *, name), | return xmlNewProp(node, signed_cast(const xmlChar *, name), | |||
signed_cast(const xmlChar *, value)); | signed_cast(const xmlChar *, value)); | |||
#endif | #endif | |||
} | } | |||
/** | /** | |||
* @ptr: parent node | * @ptr: parent node | |||
* @name: name of new node | * @name: name of new node | |||
* @value: string, or %NULL | * @value: string, or %NULL | |||
*/ | */ | |||
static inline xmlNode *xml_newnode(xmlNode *ptr, const char *name, | static __inline__ xmlNode * | |||
const char *value) | xml_newnode(xmlNode *ptr, const char *name, const char *value) | |||
{ | { | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
return xmlNewTextChild(ptr, NULL, signed_cast<const xmlChar *>(name) , | return xmlNewTextChild(ptr, NULL, signed_cast<const xmlChar *>(name) , | |||
signed_cast<const xmlChar *>(value)); | signed_cast<const xmlChar *>(value)); | |||
#else | #else | |||
return xmlNewTextChild(ptr, NULL, signed_cast(const xmlChar *, name) , | return xmlNewTextChild(ptr, NULL, signed_cast(const xmlChar *, name) , | |||
signed_cast(const xmlChar *, value)); | signed_cast(const xmlChar *, value)); | |||
#endif | #endif | |||
} | } | |||
static inline xmlAttr *xml_setprop(xmlNode *node, const char *name, | static __inline__ xmlAttr * | |||
const char *value) | xml_setprop(xmlNode *node, const char *name, const char *value) | |||
{ | { | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
return xmlSetProp(node, signed_cast<const xmlChar *>(name), | return xmlSetProp(node, signed_cast<const xmlChar *>(name), | |||
signed_cast<const xmlChar *>(value)); | signed_cast<const xmlChar *>(value)); | |||
#else | #else | |||
return xmlSetProp(node, signed_cast(const xmlChar *, name), | return xmlSetProp(node, signed_cast(const xmlChar *, name), | |||
signed_cast(const xmlChar *, value)); | signed_cast(const xmlChar *, value)); | |||
#endif | #endif | |||
} | } | |||
End of changes. 6 change blocks. | ||||
9 lines changed or deleted | 9 lines changed or added | |||
list.h | list.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
#define HXlist_entry(ptr, type, member) containerof((ptr), type, member) | #define HXlist_entry(ptr, type, member) containerof((ptr), type, member) | |||
struct HXlist_head { | struct HXlist_head { | |||
struct HXlist_head *next, *prev; | struct HXlist_head *next, *prev; | |||
}; | }; | |||
#define HXLIST_HEAD_INIT(name) {&(name), &(name)} | #define HXLIST_HEAD_INIT(name) {&(name), &(name)} | |||
#define HXLIST_HEAD(name) \ | #define HXLIST_HEAD(name) \ | |||
struct HXlist_head name = HXLIST_HEAD_INIT(name) | struct HXlist_head name = HXLIST_HEAD_INIT(name) | |||
static inline void HXlist_init(struct HXlist_head *list) | static __inline__ void HXlist_init(struct HXlist_head *list) | |||
{ | { | |||
list->next = list->prev = list; | list->next = list->prev = list; | |||
} | } | |||
static inline void __HXlist_add(struct HXlist_head *nu, | static __inline__ void __HXlist_add(struct HXlist_head *nu, | |||
struct HXlist_head *prev, struct HXlist_head *next) | struct HXlist_head *prev, struct HXlist_head *next) | |||
{ | { | |||
nu->next = next; | nu->next = next; | |||
nu->prev = prev; | nu->prev = prev; | |||
next->prev = nu; | next->prev = nu; | |||
prev->next = nu; | prev->next = nu; | |||
} | } | |||
static inline void HXlist_add(struct HXlist_head *head, | static __inline__ void | |||
struct HXlist_head *entry) | HXlist_add(struct HXlist_head *head, struct HXlist_head *entry) | |||
{ | { | |||
__HXlist_add(entry, head, head->next); | __HXlist_add(entry, head, head->next); | |||
} | } | |||
static inline void HXlist_add_tail(struct HXlist_head *head, | static __inline__ void | |||
struct HXlist_head *entry) | HXlist_add_tail(struct HXlist_head *head, struct HXlist_head *entry) | |||
{ | { | |||
__HXlist_add(entry, head->prev, head); | __HXlist_add(entry, head->prev, head); | |||
} | } | |||
static inline void HXlist_del(struct HXlist_head *entry) | static __inline__ void HXlist_del(struct HXlist_head *entry) | |||
{ | { | |||
entry->prev->next = entry->next; | entry->prev->next = entry->next; | |||
entry->next->prev = entry->prev; | entry->next->prev = entry->prev; | |||
entry->next = NULL; | entry->next = NULL; | |||
entry->prev = NULL; | entry->prev = NULL; | |||
} | } | |||
static inline bool HXlist_empty(const struct HXlist_head *head) | static __inline__ bool HXlist_empty(const struct HXlist_head *head) | |||
{ | { | |||
return head->next == head; | return head->next == head; | |||
} | } | |||
#define HXlist_for_each(pos, head) \ | #define HXlist_for_each(pos, head) \ | |||
for ((pos) = (head)->next; (pos) != (void *)(head); \ | for ((pos) = (head)->next; (pos) != (void *)(head); \ | |||
(pos) = (pos)->next) | (pos) = (pos)->next) | |||
#define HXlist_for_each_rev(pos, head) \ | #define HXlist_for_each_rev(pos, head) \ | |||
for ((pos) = (head)->prev; (pos) != (void *)(head); \ | for ((pos) = (head)->prev; (pos) != (void *)(head); \ | |||
skipping to change at line 112 | skipping to change at line 112 | |||
struct HXlist_head *next, *prev; | struct HXlist_head *next, *prev; | |||
}; | }; | |||
}; | }; | |||
unsigned int items; | unsigned int items; | |||
}; | }; | |||
#define HXCLIST_HEAD_INIT(name) {{{&(name).list, &(name).list}}, 0} | #define HXCLIST_HEAD_INIT(name) {{{&(name).list, &(name).list}}, 0} | |||
#define HXCLIST_HEAD(name) \ | #define HXCLIST_HEAD(name) \ | |||
struct HXclist_head name = HXCLIST_HEAD_INIT(name) | struct HXclist_head name = HXCLIST_HEAD_INIT(name) | |||
static inline void HXclist_init(struct HXclist_head *head) | static __inline__ void HXclist_init(struct HXclist_head *head) | |||
{ | { | |||
head->list.next = head->list.prev = &head->list; | head->list.next = head->list.prev = &head->list; | |||
head->items = 0; | head->items = 0; | |||
} | } | |||
static inline void HXclist_del(struct HXclist_head *head, | static __inline__ void | |||
struct HXlist_head *node) | HXclist_del(struct HXclist_head *head, struct HXlist_head *node) | |||
{ | { | |||
--head->items; | --head->items; | |||
HXlist_del(node); | HXlist_del(node); | |||
} | } | |||
static inline void HXclist_unshift(struct HXclist_head *head, | static __inline__ void | |||
struct HXlist_head *nu) | HXclist_unshift(struct HXclist_head *head, struct HXlist_head *nu) | |||
{ | { | |||
++head->items; | ++head->items; | |||
__HXlist_add(nu, &head->list, head->list.next); | __HXlist_add(nu, &head->list, head->list.next); | |||
} | } | |||
static inline void HXclist_push(struct HXclist_head *head, | static __inline__ void | |||
struct HXlist_head *nu) | HXclist_push(struct HXclist_head *head, struct HXlist_head *nu) | |||
{ | { | |||
++head->items; | ++head->items; | |||
__HXlist_add(nu, head->list.prev, &head->list); | __HXlist_add(nu, head->list.prev, &head->list); | |||
} | } | |||
static inline struct HXlist_head *__HXclist_pop(struct HXclist_head *head) | static __inline__ struct HXlist_head *__HXclist_pop(struct HXclist_head *he ad) | |||
{ | { | |||
struct HXlist_head *p; | struct HXlist_head *p; | |||
if ((const void *)head == head->list.next) | if ((const void *)head == head->list.next) | |||
return NULL; | return NULL; | |||
p = head->list.prev; | p = head->list.prev; | |||
HXlist_del(p); | HXlist_del(p); | |||
--head->items; | --head->items; | |||
return p; | return p; | |||
} | } | |||
#define HXclist_pop(head, type, member) \ | #define HXclist_pop(head, type, member) \ | |||
HXlist_entry(__HXclist_pop(head), type, member) | HXlist_entry(__HXclist_pop(head), type, member) | |||
static inline struct HXlist_head *__HXclist_shift(struct HXclist_head *head | static __inline__ struct HXlist_head * | |||
) | __HXclist_shift(struct HXclist_head *head) | |||
{ | { | |||
struct HXlist_head *p; | struct HXlist_head *p; | |||
if ((const void *)head == head->list.next) | if ((const void *)head == head->list.next) | |||
return NULL; | return NULL; | |||
p = head->list.next; | p = head->list.next; | |||
HXlist_del(p); | HXlist_del(p); | |||
--head->items; | --head->items; | |||
return p; | return p; | |||
} | } | |||
End of changes. 12 change blocks. | ||||
18 lines changed or deleted | 18 lines changed or added | |||
map.h | map.h | |||
---|---|---|---|---|
skipping to change at line 125 | skipping to change at line 125 | |||
extern unsigned long HXhash_jlookup3(const void *, size_t); | extern unsigned long HXhash_jlookup3(const void *, size_t); | |||
extern unsigned long HXhash_jlookup3s(const void *, size_t); | extern unsigned long HXhash_jlookup3s(const void *, size_t); | |||
extern unsigned long HXhash_djb2(const void *, size_t); | extern unsigned long HXhash_djb2(const void *, size_t); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} /* extern "C" */ | } /* extern "C" */ | |||
extern "C++" { | extern "C++" { | |||
template<typename type> static inline type | template<typename type> static __inline__ type | |||
HXmap_get(const struct HXmap *map, const void *key) | HXmap_get(const struct HXmap *map, const void *key) | |||
{ | { | |||
return reinterpret_cast<type>(HXmap_get(map, key)); | return reinterpret_cast<type>(HXmap_get(map, key)); | |||
} | } | |||
template<typename type> static inline type | template<typename type> static __inline__ type | |||
HXmap_del(struct HXmap *map, const void *key) | HXmap_del(struct HXmap *map, const void *key) | |||
{ | { | |||
return reinterpret_cast<type>(HXmap_del(map, key)); | return reinterpret_cast<type>(HXmap_del(map, key)); | |||
} | } | |||
} | } | |||
#endif | #endif | |||
#endif /* _LIBHX_MAP_H */ | #endif /* _LIBHX_MAP_H */ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
misc.h | misc.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
(((bits) + __HXbitmap_bpq(type) - 1) / __HXbitmap_bpq(type)) | (((bits) + __HXbitmap_bpq(type) - 1) / __HXbitmap_bpq(type)) | |||
#define __HXbitmap_quant(map, bit) \ | #define __HXbitmap_quant(map, bit) \ | |||
((map)[(bit) / __HXbitmap_bpq(*(map))]) | ((map)[(bit) / __HXbitmap_bpq(*(map))]) | |||
#define HXbitmap_set(map, bit) \ | #define HXbitmap_set(map, bit) \ | |||
((void)(__HXbitmap_quant((map), (bit)) |= (1ULL << ((bit) % __HXbitm ap_bpq(*(map)))))) | ((void)(__HXbitmap_quant((map), (bit)) |= (1ULL << ((bit) % __HXbitm ap_bpq(*(map)))))) | |||
#define HXbitmap_clear(map, bit) \ | #define HXbitmap_clear(map, bit) \ | |||
((void)(__HXbitmap_quant((map), (bit)) &= ~(1ULL << ((bit) % __HXbit map_bpq(*(map)))))) | ((void)(__HXbitmap_quant((map), (bit)) &= ~(1ULL << ((bit) % __HXbit map_bpq(*(map)))))) | |||
#define HXbitmap_test(map, bit) \ | #define HXbitmap_test(map, bit) \ | |||
((bool)(__HXbitmap_quant((map), (bit)) & (1ULL << ((bit) % __HXbitma p_bpq(*(map)))))) | ((bool)(__HXbitmap_quant((map), (bit)) & (1ULL << ((bit) % __HXbitma p_bpq(*(map)))))) | |||
#define HX_TIMESPEC_EXP(p) static_cast(long, (p)->tv_sec), (p)->tv_nsec | ||||
#define HX_TIMESPEC_FMT "%ld.%09ld" | #define HX_TIMESPEC_FMT "%ld.%09ld" | |||
#define HX_TIMEVAL_EXP(p) static_cast(long, (p)->tv_sec), (p)->tv_usec | ||||
#define HX_TIMEVAL_FMT "%ld.%06ld" | #define HX_TIMEVAL_FMT "%ld.%06ld" | |||
#ifdef __cplusplus | ||||
# define HX_TIMESPEC_EXP(p) static_cast<long>((p)->tv_sec), (p)->tv_ns | ||||
ec | ||||
# define HX_TIMEVAL_EXP(p) static_cast<long>((p)->tv_sec), (p)->tv_use | ||||
c | ||||
#else | ||||
# define HX_TIMESPEC_EXP(p) static_cast(long, (p)->tv_sec), (p)->tv_ns | ||||
ec | ||||
# define HX_TIMEVAL_EXP(p) static_cast(long, (p)->tv_sec), (p)->tv_use | ||||
c | ||||
#endif | ||||
struct stat; | struct stat; | |||
struct timespec; | struct timespec; | |||
struct timeval; | struct timeval; | |||
/* | /* | |||
* DL.C | * DL.C | |||
*/ | */ | |||
extern void *HX_dlopen(const char *); | extern void *HX_dlopen(const char *); | |||
extern void *HX_dlsym(void *, const char *); | extern void *HX_dlsym(void *, const char *); | |||
skipping to change at line 86 | skipping to change at line 91 | |||
/* | /* | |||
* RAND.C | * RAND.C | |||
*/ | */ | |||
extern int HX_rand(void); | extern int HX_rand(void); | |||
extern unsigned int HX_irand(unsigned int, unsigned int); | extern unsigned int HX_irand(unsigned int, unsigned int); | |||
extern double HX_drand(double, double); | extern double HX_drand(double, double); | |||
/* | /* | |||
* INLINE FUNCTIONS | * INLINE FUNCTIONS | |||
*/ | */ | |||
static inline unsigned int HX_zveclen(const char *const *args) | static __inline__ unsigned int HX_zveclen(const char *const *args) | |||
{ | { | |||
unsigned int argk = 0; | unsigned int argk = 0; | |||
while (*args++ != NULL) | while (*args++ != NULL) | |||
++argk; | ++argk; | |||
return argk; | return argk; | |||
} | } | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} /* extern "C" */ | } /* extern "C" */ | |||
extern "C++" { | extern "C++" { | |||
template<typename type> static inline type | template<typename type> static __inline__ type | |||
HX_dlsym(void *handle, const char *symbol) | HX_dlsym(void *handle, const char *symbol) | |||
{ | { | |||
return reinterpret_cast<type>(HX_dlsym(handle, symbol)); | return reinterpret_cast<type>(HX_dlsym(handle, symbol)); | |||
} | } | |||
} /* extern "C++" */ | } /* extern "C++" */ | |||
#endif | #endif | |||
#endif /* _LIBHX_MISC_H */ | #endif /* _LIBHX_MISC_H */ | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 13 lines changed or added | |||
string.h | string.h | |||
---|---|---|---|---|
skipping to change at line 87 | skipping to change at line 87 | |||
extern char *HX_strndup(const char *, size_t); | extern char *HX_strndup(const char *, size_t); | |||
extern size_t HX_strnlen(const char *, size_t); | extern size_t HX_strnlen(const char *, size_t); | |||
extern char *HX_strquote(const char *, unsigned int, char **); | extern char *HX_strquote(const char *, unsigned int, char **); | |||
extern size_t HX_strrcspn(const char *, const char *); | extern size_t HX_strrcspn(const char *, const char *); | |||
extern char *HX_strrev(char *); | extern char *HX_strrev(char *); | |||
extern size_t HX_strrtrim(char *); | extern size_t HX_strrtrim(char *); | |||
extern char *HX_strsep(char **, const char *); | extern char *HX_strsep(char **, const char *); | |||
extern char *HX_strsep2(char **, const char *); | extern char *HX_strsep2(char **, const char *); | |||
extern char *HX_strupper(char *); | extern char *HX_strupper(char *); | |||
static inline void *HX_memdup(const void *buf, size_t len) | static __inline__ void *HX_memdup(const void *buf, size_t len) | |||
{ | { | |||
void *ret; | void *ret; | |||
if ((ret = malloc(len)) == NULL) | if ((ret = malloc(len)) == NULL) | |||
return NULL; | return NULL; | |||
return memcpy(ret, buf, len); | return memcpy(ret, buf, len); | |||
} | } | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} /* extern "C" */ | } /* extern "C" */ | |||
#endif | #endif | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C++" { | extern "C++" { | |||
template<typename type> static inline type | template<typename type> static __inline__ type | |||
HX_memdup(const void *data, size_t n) | HX_memdup(const void *data, size_t n) | |||
{ | { | |||
return reinterpret_cast<type>(HX_memdup(data, n)); | return reinterpret_cast<type>(HX_memdup(data, n)); | |||
} | } | |||
} /* extern "C++" */ | } /* extern "C++" */ | |||
#endif | #endif | |||
#endif /* _LIBHX_STRING_H */ | #endif /* _LIBHX_STRING_H */ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||