clist.h | clist.h | |||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
#include <libHX/list.h> | #include <libHX/list.h> | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
struct HXclist_head { | struct HXclist_head { | |||
union { | union { | |||
struct HXlist_head list; | struct HXlist_head list; | |||
struct HXlist_head *next, *prev; | struct { | |||
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 __attribute__((deprecated)) inline void | ||||
HXclist_init_head(struct HXclist_head *head) | ||||
{ | ||||
head->list.next = head->list.prev = &head->list; | ||||
head->items = 0; | ||||
} | ||||
static inline void HXclist_del(struct HXclist_head *head, | static inline void HXclist_del(struct HXclist_head *head, | |||
struct HXlist_head *node) | 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 HXclist_unshift(struct HXclist_head *head, | |||
struct HXlist_head *nu) | struct HXlist_head *nu) | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
8 lines changed or deleted | 3 lines changed or added | |||
libHX.h | libHX.h | |||
---|---|---|---|---|
/* | /* | |||
* libHX/libHX.h | * libHX/libHX.h | |||
* Copyright © Jan Engelhardt <jengelh [at] gmx de>, 1999 - 2008 | * Copyright © Jan Engelhardt <jengelh [at] gmx de>, 1999 - 2008 | |||
* | * | |||
* This file is part of libHX. libHX is free software; you can | * This file is part of libHX. libHX is free software; you can | |||
* redistribute it and/or modify it under the terms of the GNU | * redistribute it and/or modify it under the terms of the GNU | |||
* Lesser General Public License as published by the Free Software | * Lesser General Public License as published by the Free Software | |||
* Foundation; either version 2 or 3 of the License. | * Foundation; either version 2 or 3 of the License. | |||
*/ | */ | |||
#ifndef _LIBHX_H | #ifndef _LIBHX_H | |||
#define _LIBHX_H 20080402 | #define _LIBHX_H 20080610 | |||
#ifndef __cplusplus | #ifndef __cplusplus | |||
# include <stdarg.h> | # include <stdarg.h> | |||
# include <stdio.h> | # include <stdio.h> | |||
# include <stdlib.h> | # include <stdlib.h> | |||
# include <string.h> | # include <string.h> | |||
#else | #else | |||
# include <cstdarg> | # include <cstdarg> | |||
# include <cstdio> | # include <cstdio> | |||
# include <cstdlib> | # include <cstdlib> | |||
skipping to change at line 78 | skipping to change at line 78 | |||
/* | /* | |||
* OTHER.C | * OTHER.C | |||
*/ | */ | |||
enum { | enum { | |||
HX_FSYSTEM_ARGV = 1 << 0, | HX_FSYSTEM_ARGV = 1 << 0, | |||
HX_FSYSTEM_EXEC = 1 << 1, | HX_FSYSTEM_EXEC = 1 << 1, | |||
HX_FSYSTEM_ARGV1 = 1 << 2, | HX_FSYSTEM_ARGV1 = 1 << 2, | |||
}; | }; | |||
extern int HX_ffs(unsigned long); | ||||
extern void HX_zvecfree(char **); | extern void HX_zvecfree(char **); | |||
extern int HX_fsystem(unsigned int, const char *, const char *, ...); | extern int HX_fsystem(unsigned int, const char *, const char *, ...); | |||
extern int HX_vfsystem(unsigned int, const char *, const char *, va_list); | extern int HX_vfsystem(unsigned int, const char *, const char *, va_list); | |||
/* | /* | |||
* 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); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
list.h | list.h | |||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
#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 __attribute__((deprecated)) inline void | ||||
HXlist_init_head(struct HXlist_head *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 HXlist_add(struct HXlist_head *head, | |||
skipping to change at line 74 | skipping to change at line 68 | |||
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; | |||
} | } | |||
#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_prev(pos, head) \ | ||||
for ((pos) = (head)->prev; (pos) != (void *)(head); \ | ||||
(pos) = (pos)->prev) | ||||
#define HXlist_for_each_safe(pos, n, head) \ | #define HXlist_for_each_safe(pos, n, head) \ | |||
for ((pos) = (head)->next, (n) = (pos)->next; (pos) != (void *)(head ); \ | for ((pos) = (head)->next, (n) = (pos)->next; (pos) != (void *)(head ); \ | |||
(pos) = (n), (n) = (pos)->next) | (pos) = (n), (n) = (pos)->next) | |||
#define HXlist_for_each_prev_safe(pos, n, head) \ | ||||
for ((pos) = (head)->prev, (n) = (pos)->prev; (pos) != (void *)(head | ||||
); \ | ||||
(pos) = (n), (n) = (pos)->prev) | ||||
#define HXlist_for_each_entry(pos, head, member) \ | #define HXlist_for_each_entry(pos, head, member) \ | |||
for ((pos) = HXlist_entry((head)->next, typeof(*(pos)), member); \ | for ((pos) = HXlist_entry((head)->next, typeof(*(pos)), member); \ | |||
&(pos)->member != (void *)(head); \ | &(pos)->member != (void *)(head); \ | |||
(pos) = HXlist_entry((pos)->member.next, typeof(*(pos)), member )) | (pos) = HXlist_entry((pos)->member.next, typeof(*(pos)), member )) | |||
#define HXlist_for_each_entry_rev(pos, head, member) \ | ||||
for ((pos) = HXlist_entry((head)->prev, typeof(*(pos)), member); \ | ||||
&(pos)->member != (void *)(head); \ | ||||
(pos) = HXlist_entry((pos)->member.prev, typeof(*(pos)), member | ||||
)) | ||||
#define HXlist_for_each_entry_safe(pos, n, head, member) \ | #define HXlist_for_each_entry_safe(pos, n, head, member) \ | |||
for ((pos) = HXlist_entry((head)->next, typeof(*(pos)), member), \ | for ((pos) = HXlist_entry((head)->next, typeof(*(pos)), member), \ | |||
(n) = HXlist_entry((pos)->member.next, typeof(*(pos)), member); \ | (n) = HXlist_entry((pos)->member.next, typeof(*(pos)), member); \ | |||
&(pos)->member != (void *)(head); \ | &(pos)->member != (void *)(head); \ | |||
(pos) = (n), (n) = HXlist_entry((n)->member.next, typeof(*(n)), \ | (pos) = (n), (n) = HXlist_entry((n)->member.next, typeof(*(n)), \ | |||
member)) | member)) | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} /* extern "C" */ | } /* extern "C" */ | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 15 lines changed or added | |||