| mowgli_assert.h | | mowgli_assert.h | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| * POSSIBILITY OF SUCH DAMAGE. | | * POSSIBILITY OF SUCH DAMAGE. | |
| */ | | */ | |
| | | | |
| #ifndef __MOWGLI_ASSERT_H__ | | #ifndef __MOWGLI_ASSERT_H__ | |
| #define __MOWGLI_ASSERT_H__ | | #define __MOWGLI_ASSERT_H__ | |
| | | | |
| /* | | /* | |
| * Performs a soft assertion. If the assertion fails, we log it. | | * Performs a soft assertion. If the assertion fails, we log it. | |
| */ | | */ | |
|
| #ifdef __GNUC__ | | | |
| #define soft_assert(x)
\ | | #define soft_assert(x)
\ | |
| if (!(x)) {
\ | | if (!(x)) {
\ | |
|
| mowgli_log("%s(%d) [%s]: critical: Assertion '%s' failed.", | | mowgli_log("critical: Assertion '%s' failed.", #x); | |
| \ | | \ | |
| __FILE__, __LINE__, __PRETTY_FUNCTION__, #x); | | | |
| \ | | | |
| } | | | |
| #else | | | |
| #define soft_assert(x) | | | |
| \ | | | |
| if (!(x)) { | | | |
| \ | | | |
| mowgli_log("%s(%d): critical: Assertion '%s' failed.", \ | | | |
| __FILE__, __LINE__, #x); | | | |
| \ | | | |
| } | | } | |
|
| #endif | | | |
| | | | |
| /* | | /* | |
| * Same as soft_assert, but returns if an assertion fails. | | * Same as soft_assert, but returns if an assertion fails. | |
| */ | | */ | |
|
| #ifdef __GNUC__ | | | |
| #define return_if_fail(x)
\ | | #define return_if_fail(x)
\ | |
| if (!(x)) {
\ | | if (!(x)) {
\ | |
|
| mowgli_log("%s(%d) [%s]: critical: Assertion '%s' failed.", | | mowgli_log("critical: Assertion '%s' failed.", #x); | |
| \ | | \ | |
| __FILE__, __LINE__, __PRETTY_FUNCTION__, #x); | | | |
| \ | | | |
| return; | | | |
| \ | | | |
| } | | | |
| #else | | | |
| #define return_if_fail(x) | | | |
| \ | | | |
| if (!(x)) { | | | |
| \ | | | |
| mowgli_log("%s(%d): critical: Assertion '%s' failed.", \ | | | |
| __FILE__, __LINE__, #x); | | | |
| \ | | | |
| return;
\ | | return;
\ | |
| } | | } | |
|
| #endif | | | |
| | | | |
| /* | | /* | |
| * Same as soft_assert, but returns a given value if an assertion fails. | | * Same as soft_assert, but returns a given value if an assertion fails. | |
| */ | | */ | |
|
| #ifdef __GNUC__ | | | |
| #define return_val_if_fail(x, y)
\ | | #define return_val_if_fail(x, y)
\ | |
| if (!(x)) {
\ | | if (!(x)) {
\ | |
|
| mowgli_log("%s(%d) [%s]: critical: Assertion '%s' failed.", | | mowgli_log("critical: Assertion '%s' failed.", #x); | |
| \ | | \ | |
| __FILE__, __LINE__, __PRETTY_FUNCTION__, #x); | | | |
| \ | | | |
| return (y); | | | |
| \ | | | |
| } | | | |
| #else | | | |
| #define return_val_if_fail(x, y) | | | |
| \ | | | |
| if (!(x)) { | | | |
| \ | | | |
| mowgli_log("%s(%d): critical: Assertion '%s' failed.", | | | |
| \ | | | |
| __FILE__, __LINE__, #x); | | | |
| \ | | | |
| return (y);
\ | | return (y);
\ | |
| } | | } | |
|
| #endif | | | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 9 change blocks. |
| 50 lines changed or deleted | | 6 lines changed or added | |
|
| mowgli_config.h | | mowgli_config.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| /* Define to 1 if the `closedir' function returns void instead of `int'. */ | | /* Define to 1 if the `closedir' function returns void instead of `int'. */ | |
| /* #undef CLOSEDIR_VOID */ | | /* #undef CLOSEDIR_VOID */ | |
| | | | |
| /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'
. | | /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'
. | |
| */ | | */ | |
| #define HAVE_DIRENT_H 1 | | #define HAVE_DIRENT_H 1 | |
| | | | |
| /* Define to 1 if you have the <errno.h> header file. */ | | /* Define to 1 if you have the <errno.h> header file. */ | |
| #define HAVE_ERRNO_H 1 | | #define HAVE_ERRNO_H 1 | |
| | | | |
|
| | | /* Define to 1 if you have the `gettimeofday' function. */ | |
| | | #define HAVE_GETTIMEOFDAY 1 | |
| | | | |
| /* Define to 1 if you have the <inttypes.h> header file. */ | | /* Define to 1 if you have the <inttypes.h> header file. */ | |
| #define HAVE_INTTYPES_H 1 | | #define HAVE_INTTYPES_H 1 | |
| | | | |
| /* Define to 1 if you have the `kdecore' library (-lkdecore). */ | | /* Define to 1 if you have the `kdecore' library (-lkdecore). */ | |
| /* #undef HAVE_LIBKDECORE */ | | /* #undef HAVE_LIBKDECORE */ | |
| | | | |
| /* Define to 1 if you have the <limits.h> header file. */ | | /* Define to 1 if you have the <limits.h> header file. */ | |
| #define HAVE_LIMITS_H 1 | | #define HAVE_LIMITS_H 1 | |
| | | | |
| /* Define to 1 if you have the <locale.h> header file. */ | | /* Define to 1 if you have the <locale.h> header file. */ | |
| #define HAVE_LOCALE_H 1 | | #define HAVE_LOCALE_H 1 | |
| | | | |
| /* Define to 1 if you have the <memory.h> header file. */ | | /* Define to 1 if you have the <memory.h> header file. */ | |
| #define HAVE_MEMORY_H 1 | | #define HAVE_MEMORY_H 1 | |
| | | | |
| /* Define to 1 if you have the `memset' function. */ | | /* Define to 1 if you have the `memset' function. */ | |
| #define HAVE_MEMSET 1 | | #define HAVE_MEMSET 1 | |
| | | | |
|
| | | /* Define to 1 if you have the `mmap' function. */ | |
| | | #define HAVE_MMAP 1 | |
| | | | |
| /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'.
*/ | | /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'.
*/ | |
| /* #undef HAVE_NDIR_H */ | | /* #undef HAVE_NDIR_H */ | |
| | | | |
|
| | | /* Define to 1 if you have the `printf' function. */ | |
| | | #define HAVE_PRINTF 1 | |
| | | | |
| /* Define to 1 if you have the `setlocale' function. */ | | /* Define to 1 if you have the `setlocale' function. */ | |
| #define HAVE_SETLOCALE 1 | | #define HAVE_SETLOCALE 1 | |
| | | | |
|
| | | /* Define to 1 if you have the `snprintf' function. */ | |
| | | #define HAVE_SNPRINTF 1 | |
| | | | |
| | | /* Define to 1 if you have the `sprintf' function. */ | |
| | | #define HAVE_SPRINTF 1 | |
| | | | |
| /* Define to 1 if `stat' has the bug that it succeeds when given the | | /* Define to 1 if `stat' has the bug that it succeeds when given the | |
| zero-length file name argument. */ | | zero-length file name argument. */ | |
| /* #undef HAVE_STAT_EMPTY_STRING_BUG */ | | /* #undef HAVE_STAT_EMPTY_STRING_BUG */ | |
| | | | |
| /* Define to 1 if you have the <stdarg.h> header file. */ | | /* Define to 1 if you have the <stdarg.h> header file. */ | |
| #define HAVE_STDARG_H 1 | | #define HAVE_STDARG_H 1 | |
| | | | |
| /* Define to 1 if you have the <stdint.h> header file. */ | | /* Define to 1 if you have the <stdint.h> header file. */ | |
| #define HAVE_STDINT_H 1 | | #define HAVE_STDINT_H 1 | |
| | | | |
| | | | |
| skipping to change at line 69 | | skipping to change at line 84 | |
| | | | |
| /* Define to 1 if you have the `strerror' function. */ | | /* Define to 1 if you have the `strerror' function. */ | |
| #define HAVE_STRERROR 1 | | #define HAVE_STRERROR 1 | |
| | | | |
| /* Define to 1 if you have the <strings.h> header file. */ | | /* Define to 1 if you have the <strings.h> header file. */ | |
| #define HAVE_STRINGS_H 1 | | #define HAVE_STRINGS_H 1 | |
| | | | |
| /* Define to 1 if you have the <string.h> header file. */ | | /* Define to 1 if you have the <string.h> header file. */ | |
| #define HAVE_STRING_H 1 | | #define HAVE_STRING_H 1 | |
| | | | |
|
| /* Define to 1 if you have the `strstr' function. */ | | /* Define to 1 if you have the `strlcat' function. */ | |
| #define HAVE_STRSTR 1 | | /* #undef HAVE_STRLCAT */ | |
| | | | |
| | | /* Define to 1 if you have the `strlcpy' function. */ | |
| | | /* #undef HAVE_STRLCPY */ | |
| | | | |
| | | /* Define to 1 if you have the `strndup' function. */ | |
| | | #define HAVE_STRNDUP 1 | |
| | | | |
| /* Define to 1 if you have the `strtod' function. */ | | /* Define to 1 if you have the `strtod' function. */ | |
| #define HAVE_STRTOD 1 | | #define HAVE_STRTOD 1 | |
| | | | |
| /* Define to 1 if you have the `strtol' function. */ | | /* Define to 1 if you have the `strtol' function. */ | |
| #define HAVE_STRTOL 1 | | #define HAVE_STRTOL 1 | |
| | | | |
| /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR
'. | | /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR
'. | |
| */ | | */ | |
| /* #undef HAVE_SYS_DIR_H */ | | /* #undef HAVE_SYS_DIR_H */ | |
| | | | |
| skipping to change at line 95 | | skipping to change at line 116 | |
| | | | |
| /* Define to 1 if you have the <sys/stat.h> header file. */ | | /* Define to 1 if you have the <sys/stat.h> header file. */ | |
| #define HAVE_SYS_STAT_H 1 | | #define HAVE_SYS_STAT_H 1 | |
| | | | |
| /* Define to 1 if you have the <sys/types.h> header file. */ | | /* Define to 1 if you have the <sys/types.h> header file. */ | |
| #define HAVE_SYS_TYPES_H 1 | | #define HAVE_SYS_TYPES_H 1 | |
| | | | |
| /* Define to 1 if you have the <unistd.h> header file. */ | | /* Define to 1 if you have the <unistd.h> header file. */ | |
| #define HAVE_UNISTD_H 1 | | #define HAVE_UNISTD_H 1 | |
| | | | |
|
| | | /* Define to 1 if you have the `vsnprintf' function. */ | |
| | | #define HAVE_VSNPRINTF 1 | |
| | | | |
| /* Define to 1 if `lstat' dereferences a symlink specified with a trailing | | /* Define to 1 if `lstat' dereferences a symlink specified with a trailing | |
| slash. */ | | slash. */ | |
| #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 | | #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 | |
| | | | |
| /* Define to the address where bug reports for this package should be sent.
*/ | | /* Define to the address where bug reports for this package should be sent.
*/ | |
| #define PACKAGE_BUGREPORT "bugs+libmowgli@atheme.org" | | #define PACKAGE_BUGREPORT "bugs+libmowgli@atheme.org" | |
| | | | |
| /* Define to the full name of this package. */ | | /* Define to the full name of this package. */ | |
| #define PACKAGE_NAME "libmowgli" | | #define PACKAGE_NAME "libmowgli" | |
| | | | |
| /* Define to the full name and version of this package. */ | | /* Define to the full name and version of this package. */ | |
|
| #define PACKAGE_STRING "libmowgli 0.1.0" | | #define PACKAGE_STRING "libmowgli 0.1.2" | |
| | | | |
| /* Define to the one symbol short name of this package. */ | | /* Define to the one symbol short name of this package. */ | |
| #define PACKAGE_TARNAME "libmowgli" | | #define PACKAGE_TARNAME "libmowgli" | |
| | | | |
| /* Define to the version of this package. */ | | /* Define to the version of this package. */ | |
|
| #define PACKAGE_VERSION "0.1.0" | | #define PACKAGE_VERSION "0.1.2" | |
| | | | |
| /* Define the shared module suffix extension on your platform. */ | | /* Define the shared module suffix extension on your platform. */ | |
| #define SHARED_SUFFIX ".so" | | #define SHARED_SUFFIX ".so" | |
| | | | |
| /* Define to 1 if you have the ANSI C header files. */ | | /* Define to 1 if you have the ANSI C header files. */ | |
| #define STDC_HEADERS 1 | | #define STDC_HEADERS 1 | |
| | | | |
| /* Define to empty if `const' does not conform to ANSI C. */ | | /* Define to empty if `const' does not conform to ANSI C. */ | |
| /* #undef const */ | | /* #undef const */ | |
| | | | |
End of changes. 8 change blocks. |
| 4 lines changed or deleted | | 28 lines changed or added | |
|
| mowgli_list.h | | mowgli_list.h | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| /* macros for linked lists */ | | /* macros for linked lists */ | |
| #define MOWGLI_LIST_FOREACH(n, head) for (n = (head); n; n = n->next) | | #define MOWGLI_LIST_FOREACH(n, head) for (n = (head); n; n = n->next) | |
| #define MOWGLI_LIST_FOREACH_NEXT(n, head) for (n = (head); n->next; n = n->
next) | | #define MOWGLI_LIST_FOREACH_NEXT(n, head) for (n = (head); n->next; n = n->
next) | |
| #define MOWGLI_LIST_FOREACH_PREV(n, tail) for (n = (tail); n; n = n->prev) | | #define MOWGLI_LIST_FOREACH_PREV(n, tail) for (n = (tail); n; n = n->prev) | |
| | | | |
| #define MOWGLI_LIST_LENGTH(list) (list)->count | | #define MOWGLI_LIST_LENGTH(list) (list)->count | |
| | | | |
| #define MOWGLI_LIST_FOREACH_SAFE(n, tn, head) for (n = (head), tn = n ? n->
next : NULL; n != NULL; n = tn, tn = n ? n->next : NULL) | | #define MOWGLI_LIST_FOREACH_SAFE(n, tn, head) for (n = (head), tn = n ? n->
next : NULL; n != NULL; n = tn, tn = n ? n->next : NULL) | |
| | | | |
| /* list node struct */ | | /* list node struct */ | |
|
| typedef struct mowgli_node_ | | typedef struct mowgli_node_ mowgli_node_t; | |
| | | typedef struct mowgli_list_ mowgli_list_t; | |
| | | | |
| | | struct mowgli_node_ | |
| { | | { | |
| struct mowgli_node_ *next, *prev; | | struct mowgli_node_ *next, *prev; | |
| void *data; /* pointer to real structure */ | | void *data; /* pointer to real structure */ | |
|
| } mowgli_node_t; | | mowgli_list_t *parent; | |
| | | }; | |
| | | | |
| /* node list struct */ | | /* node list struct */ | |
|
| typedef struct mowgli_list_ | | struct mowgli_list_ | |
| { | | { | |
| mowgli_node_t *head, *tail; | | mowgli_node_t *head, *tail; | |
| size_t count; /* how many entries in the list */ | | size_t count; /* how many entries in the list */ | |
|
| } mowgli_list_t; | | }; | |
| | | | |
| extern void mowgli_node_init(void); | | extern void mowgli_node_init(void); | |
| extern mowgli_node_t *mowgli_node_create(void); | | extern mowgli_node_t *mowgli_node_create(void); | |
| extern void mowgli_node_free(mowgli_node_t *n); | | extern void mowgli_node_free(mowgli_node_t *n); | |
| extern void mowgli_node_add(void *data, mowgli_node_t *n, mowgli_list_t *l)
; | | extern void mowgli_node_add(void *data, mowgli_node_t *n, mowgli_list_t *l)
; | |
| extern void mowgli_node_add_head(void *data, mowgli_node_t *n, mowgli_list_
t *l); | | extern void mowgli_node_add_head(void *data, mowgli_node_t *n, mowgli_list_
t *l); | |
| extern void mowgli_node_add_before(void *data, mowgli_node_t *n, mowgli_lis
t_t *l, mowgli_node_t *before); | | extern void mowgli_node_add_before(void *data, mowgli_node_t *n, mowgli_lis
t_t *l, mowgli_node_t *before); | |
|
| | | extern void mowgli_node_insert(void *data, mowgli_node_t *n, mowgli_list_t | |
| | | *l, int position); | |
| | | extern int mowgli_node_index(mowgli_node_t *n, mowgli_list_t *l); | |
| extern void mowgli_node_delete(mowgli_node_t *n, mowgli_list_t *l); | | extern void mowgli_node_delete(mowgli_node_t *n, mowgli_list_t *l); | |
| extern mowgli_node_t *mowgli_node_find(void *data, mowgli_list_t *l); | | extern mowgli_node_t *mowgli_node_find(void *data, mowgli_list_t *l); | |
| extern void mowgli_node_move(mowgli_node_t *m, mowgli_list_t *oldlist, mowg
li_list_t *newlist); | | extern void mowgli_node_move(mowgli_node_t *m, mowgli_list_t *oldlist, mowg
li_list_t *newlist); | |
|
| | | extern mowgli_list_t *mowgli_node_parent(mowgli_node_t *n); | |
| | | extern mowgli_node_t *mowgli_node_nth(mowgli_list_t *l, int pos); | |
| | | extern void *mowgli_node_nth_data(mowgli_list_t *l, int pos); | |
| | | | |
| | | extern mowgli_list_t *mowgli_list_create(void); | |
| | | extern void mowgli_list_free(mowgli_list_t *l); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 6 change blocks. |
| 4 lines changed or deleted | | 17 lines changed or added | |
|
| mowgli_queue.h | | mowgli_queue.h | |
| /* | | /* | |
| * libmowgli: A collection of useful routines for programming. | | * libmowgli: A collection of useful routines for programming. | |
|
| * mowgli_queue.h: Double-linked queues. | | * mowgli_queue.h: Double-ended queues, also known as deque. | |
| * | | * | |
| * Copyright (c) 2007 William Pitcock <nenolod -at- sacredspiral.co.uk> | | * Copyright (c) 2007 William Pitcock <nenolod -at- sacredspiral.co.uk> | |
| * | | * | |
| * Redistribution and use in source and binary forms, with or without | | * Redistribution and use in source and binary forms, with or without | |
| * modification, are permitted provided that the following conditions are | | * modification, are permitted provided that the following conditions are | |
| * met: | | * met: | |
| * | | * | |
| * 1. Redistributions of source code must retain the above copyright notice
, | | * 1. Redistributions of source code must retain the above copyright notice
, | |
| * this list of conditions and the following disclaimer. | | * this list of conditions and the following disclaimer. | |
| * | | * | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| */ | | */ | |
| | | | |
| #ifndef __MOWGLI_QUEUE_H__ | | #ifndef __MOWGLI_QUEUE_H__ | |
| #define __MOWGLI_QUEUE_H__ | | #define __MOWGLI_QUEUE_H__ | |
| | | | |
| typedef struct mowgli_queue_ { | | typedef struct mowgli_queue_ { | |
| struct mowgli_queue_ *prev, *next; | | struct mowgli_queue_ *prev, *next; | |
| void *data; | | void *data; | |
| } mowgli_queue_t; | | } mowgli_queue_t; | |
| | | | |
|
| extern mowgli_queue_t *mowgli_queue_append(mowgli_queue_t *head, void *data | | extern void mowgli_queue_init(void); | |
| ); | | extern mowgli_queue_t *mowgli_queue_push(mowgli_queue_t *head, void *data); | |
| | | extern mowgli_queue_t *mowgli_queue_shift(mowgli_queue_t *head, void *data) | |
| | | ; | |
| extern mowgli_queue_t *mowgli_queue_remove(mowgli_queue_t *head); | | extern mowgli_queue_t *mowgli_queue_remove(mowgli_queue_t *head); | |
| extern mowgli_queue_t *mowgli_queue_find(mowgli_queue_t *head, void *data); | | extern mowgli_queue_t *mowgli_queue_find(mowgli_queue_t *head, void *data); | |
| extern mowgli_queue_t *mowgli_queue_remove_data(mowgli_queue_t *head, void
*data); | | extern mowgli_queue_t *mowgli_queue_remove_data(mowgli_queue_t *head, void
*data); | |
| extern void mowgli_queue_free(mowgli_queue_t *head); | | extern void mowgli_queue_free(mowgli_queue_t *head); | |
|
| | | extern mowgli_queue_t *mowgli_queue_skip(mowgli_queue_t *head, int amt); | |
| | | extern mowgli_queue_t *mowgli_queue_rewind(mowgli_queue_t *head, int amt); | |
| | | extern mowgli_queue_t *mowgli_queue_head(mowgli_queue_t *n); | |
| | | extern mowgli_queue_t *mowgli_queue_tail(mowgli_queue_t *n); | |
| | | extern void *mowgli_queue_pop_head(mowgli_queue_t **n); | |
| | | extern void *mowgli_queue_pop_tail(mowgli_queue_t **n); | |
| | | extern int mowgli_queue_length(mowgli_queue_t *head); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 12 lines changed or added | |
|