| mowgli.h | | mowgli.h | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| # define MOWGLI_DECLS_START extern "C" { | | # define MOWGLI_DECLS_START extern "C" { | |
| # define MOWGLI_DECLS_END } | | # define MOWGLI_DECLS_END } | |
| #else | | #else | |
| # define MOWGLI_DECLS_START | | # define MOWGLI_DECLS_START | |
| # define MOWGLI_DECLS_END | | # define MOWGLI_DECLS_END | |
| #endif | | #endif | |
| | | | |
| #ifdef MOWGLI_CORE | | #ifdef MOWGLI_CORE | |
|
| | | # include "win32_support.h" | |
| # include "mowgli_config.h" | | # include "mowgli_config.h" | |
| #endif | | #endif | |
| | | | |
| #include "mowgli_stdinc.h" | | #include "mowgli_stdinc.h" | |
| | | | |
| MOWGLI_DECLS_START | | MOWGLI_DECLS_START | |
| | | | |
| #include "mowgli_logger.h" | | #include "mowgli_logger.h" | |
| #include "mowgli_assert.h" | | #include "mowgli_assert.h" | |
| #include "mowgli_exception.h" | | #include "mowgli_exception.h" | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 1 lines changed or added | |
|
| mowgli_assert.h | | mowgli_assert.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
| * 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__ | |
| | | | |
|
| | | extern void mowgli_soft_assert_log(const char *asrt, const char *file, int | |
| | | line, const char *function); | |
| | | | |
| | | #ifdef __GNUC__ | |
| | | | |
| /* | | /* | |
| * Performs a soft assertion. If the assertion fails, we log it. | | * Performs a soft assertion. If the assertion fails, we log it. | |
| */ | | */ | |
|
| #define soft_assert(x) | | #define soft_assert(x) | |
| \ | | \ | |
| if (!(x)) { | | if (!(x)) { | |
| \ | | \ | |
| mowgli_log("critical: Assertion '%s' failed.", #x); | | mowgli_soft_assert_log(#x, __FILE__, __LINE__, __PRETTY_FUN | |
| \ | | CTION__); \ | |
| } | | } | |
| | | | |
| /* | | /* | |
| * Same as soft_assert, but returns if an assertion fails. | | * Same as soft_assert, but returns if an assertion fails. | |
| */ | | */ | |
|
| #define return_if_fail(x) | | #define return_if_fail(x) | |
| \ | | \ | |
| if (!(x)) { | | if (!(x)) { | |
| \ | | \ | |
| mowgli_log("critical: Assertion '%s' failed.", #x); | | mowgli_soft_assert_log(#x, __FILE__, __LINE__, __PRETTY_FUN | |
| \ | | CTION__); \ | |
| return; | | return; | |
| \ | | \ | |
| } | | } | |
| | | | |
| /* | | /* | |
| * 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. | |
| */ | | */ | |
|
| #define return_val_if_fail(x, y) | | #define return_val_if_fail(x, y) | |
| \ | | \ | |
| if (!(x)) { | | if (!(x)) { | |
| \ | | \ | |
| mowgli_log("critical: Assertion '%s' failed.", #x); | | mowgli_soft_assert_log(#x, __FILE__, __LINE__, __PRETTY_FUN | |
| \ | | CTION__); \ | |
| return (y); | | return (y); | |
| \ | | \ | |
| } | | } | |
| | | | |
| /* | | /* | |
| * Same as soft_assert, but returns NULL if the value is NULL. | | * Same as soft_assert, but returns NULL if the value is NULL. | |
| */ | | */ | |
|
| #define return_if_null(x) | | #define return_if_null(x) | |
| \ | | \ | |
| if (x == NULL) { | | if (x == NULL) { | |
| \ | | \ | |
| mowgli_log("critical: Assertion '%s' failed.", #x); | | mowgli_soft_assert_log(#x, __FILE__, __LINE__, __PRETTY_FUN | |
| \ | | CTION__); \ | |
| return (NULL); | | return (NULL); | |
| \ | | \ | |
| } | | } | |
| | | | |
|
| | | #else | |
| | | | |
| | | /* | |
| | | * Performs a soft assertion. If the assertion fails, we log it. | |
| | | */ | |
| | | #define soft_assert(x) | |
| | | \ | |
| | | if (!(x)) { | |
| | | \ | |
| | | mowgli_soft_assert_log(#x, __FILE__, __LINE__, __FUNCTION__) | |
| | | ; \ | |
| | | } | |
| | | | |
| | | /* | |
| | | * Same as soft_assert, but returns if an assertion fails. | |
| | | */ | |
| | | #define return_if_fail(x) | |
| | | \ | |
| | | if (!(x)) { | |
| | | \ | |
| | | mowgli_soft_assert_log(#x, __FILE__, __LINE__, __FUNCTION__) | |
| | | ; \ | |
| | | return; | |
| | | \ | |
| | | } | |
| | | | |
| | | /* | |
| | | * Same as soft_assert, but returns a given value if an assertion fails. | |
| | | */ | |
| | | #define return_val_if_fail(x, y) | |
| | | \ | |
| | | if (!(x)) { | |
| | | \ | |
| | | mowgli_soft_assert_log(#x, __FILE__, __LINE__, __FUNCTION__) | |
| | | ; \ | |
| | | return (y); | |
| | | \ | |
| | | } | |
| | | | |
| | | /* | |
| | | * Same as soft_assert, but returns NULL if the value is NULL. | |
| | | */ | |
| | | #define return_if_null(x) | |
| | | \ | |
| | | if (x == NULL) { | |
| | | \ | |
| | | mowgli_soft_assert_log(#x, __FILE__, __LINE__, __FUNCTION__) | |
| | | ; \ | |
| | | return (NULL); | |
| | | \ | |
| | | } | |
| | | | |
| | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 6 change blocks. |
| 30 lines changed or deleted | | 89 lines changed or added | |
|
| mowgli_config.h | | mowgli_config.h | |
| | | | |
| skipping to change at line 133 | | skipping to change at line 133 | |
| 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.7.1" | | #define PACKAGE_STRING "libmowgli 0.9.50" | |
| | | | |
| /* 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 home page for this package. */ | | /* Define to the home page for this package. */ | |
| #define PACKAGE_URL "" | | #define PACKAGE_URL "" | |
| | | | |
| /* Define to the version of this package. */ | | /* Define to the version of this package. */ | |
|
| #define PACKAGE_VERSION "0.7.1" | | #define PACKAGE_VERSION "0.9.50" | |
| | | | |
| /* 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. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| mowgli_logger.h | | mowgli_logger.h | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
| * 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_LOGGER_H__ | | #ifndef __MOWGLI_LOGGER_H__ | |
| #define __MOWGLI_LOGGER_H__ | | #define __MOWGLI_LOGGER_H__ | |
| | | | |
| typedef void (*mowgli_log_cb_t)(const char *); | | typedef void (*mowgli_log_cb_t)(const char *); | |
| | | | |
|
| #ifdef WIN32_MSC | | | |
| # define __func__ __FUNCTION__ | | | |
| #endif | | | |
| | | | |
| #ifdef __GNUC__ | | #ifdef __GNUC__ | |
| # define mowgli_log(...) mowgli_log_real(__FILE__, __LINE__, __PRETTY_FUNCT
ION__, __VA_ARGS__) | | # define mowgli_log(...) mowgli_log_real(__FILE__, __LINE__, __PRETTY_FUNCT
ION__, __VA_ARGS__) | |
|
| | | #elif defined _MSC_VER | |
| | | # if _MSC_VER <= 1200 | |
| | | static __inline void mowgli_log(char *fmt, ...) { /* TODO/UNSUPPORTED */ | |
| | | } | |
| | | # else | |
| | | # define mowgli_log(...) mowgli_log_real(__FILE__, __LINE__, __FUNCTION__, | |
| | | __VA_ARGS__) | |
| | | # endif | |
| #else | | #else | |
| # define mowgli_log(...) mowgli_log_real(__FILE__, __LINE__, __func__, __VA
_ARGS__) | | # define mowgli_log(...) mowgli_log_real(__FILE__, __LINE__, __func__, __VA
_ARGS__) | |
| #endif | | #endif | |
| | | | |
| extern void mowgli_log_real(const char *file, int line, const char *func, c
onst char *buf, ...); | | extern void mowgli_log_real(const char *file, int line, const char *func, c
onst char *buf, ...); | |
| | | | |
| extern void mowgli_log_set_cb(mowgli_log_cb_t callback); | | extern void mowgli_log_set_cb(mowgli_log_cb_t callback); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 2 change blocks. |
| 4 lines changed or deleted | | 8 lines changed or added | |
|
| mowgli_patricia.h | | mowgli_patricia.h | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 65 | |
| | | | |
| /* | | /* | |
| * this is a convenience macro for inlining iteration of dictionaries. | | * this is a convenience macro for inlining iteration of dictionaries. | |
| */ | | */ | |
| #define MOWGLI_PATRICIA_FOREACH(element, state, dict) for (mowgli_patricia_
foreach_start((dict), (state)); (element = mowgli_patricia_foreach_cur((dic
t), (state))); mowgli_patricia_foreach_next((dict), (state))) | | #define MOWGLI_PATRICIA_FOREACH(element, state, dict) for (mowgli_patricia_
foreach_start((dict), (state)); (element = mowgli_patricia_foreach_cur((dic
t), (state))); mowgli_patricia_foreach_next((dict), (state))) | |
| | | | |
| /* | | /* | |
| * mowgli_patricia_create() creates a new patricia tree of the defined reso
lution. | | * mowgli_patricia_create() creates a new patricia tree of the defined reso
lution. | |
| * compare_cb is the canonizing function. | | * compare_cb is the canonizing function. | |
| */ | | */ | |
|
| | | | |
| | | /* defined if this version of Mowgli allows canonize_cb to be NULL */ | |
| | | #define MOWGLI_PATRICIA_ALLOWS_NULL_CANONIZE | |
| | | | |
| extern mowgli_patricia_t *mowgli_patricia_create(void (*canonize_cb)(char *
key)); | | extern mowgli_patricia_t *mowgli_patricia_create(void (*canonize_cb)(char *
key)); | |
| | | | |
| /* | | /* | |
| * mowgli_patricia_destroy() destroys all entries in a dtree, and also opti
onally calls | | * mowgli_patricia_destroy() destroys all entries in a dtree, and also opti
onally calls | |
| * a defined callback function to destroy any data attached to it. | | * a defined callback function to destroy any data attached to it. | |
| */ | | */ | |
| extern void mowgli_patricia_destroy(mowgli_patricia_t *dtree, | | extern void mowgli_patricia_destroy(mowgli_patricia_t *dtree, | |
| void (*destroy_cb)(const char *key, void *data, void *privdata), | | void (*destroy_cb)(const char *key, void *data, void *privdata), | |
| void *privdata); | | void *privdata); | |
| | | | |
| | | | |
| skipping to change at line 133 | | skipping to change at line 137 | |
| /* | | /* | |
| * mowgli_patricia_find() returns data from a dtree for key 'key'. | | * mowgli_patricia_find() returns data from a dtree for key 'key'. | |
| */ | | */ | |
| extern void *mowgli_patricia_retrieve(mowgli_patricia_t *dtree, const char
*key); | | extern void *mowgli_patricia_retrieve(mowgli_patricia_t *dtree, const char
*key); | |
| | | | |
| /* | | /* | |
| * mowgli_patricia_delete() deletes a key->value entry from the patricia tr
ee. | | * mowgli_patricia_delete() deletes a key->value entry from the patricia tr
ee. | |
| */ | | */ | |
| extern void *mowgli_patricia_delete(mowgli_patricia_t *dtree, const char *k
ey); | | extern void *mowgli_patricia_delete(mowgli_patricia_t *dtree, const char *k
ey); | |
| | | | |
|
| | | /* Low-level functions */ | |
| | | mowgli_patricia_elem_t *mowgli_patricia_elem_add(mowgli_patricia_t *dtree, | |
| | | const char *key, void *data); | |
| | | mowgli_patricia_elem_t *mowgli_patricia_elem_find(mowgli_patricia_t *dtree, | |
| | | const char *key); | |
| | | void mowgli_patricia_elem_delete(mowgli_patricia_t *dtree, mowgli_patricia_ | |
| | | elem_t *elem); | |
| | | const char *mowgli_patricia_elem_get_key(mowgli_patricia_elem_t *elem); | |
| | | void mowgli_patricia_elem_set_data(mowgli_patricia_elem_t *elem, void *data | |
| | | ); | |
| | | void *mowgli_patricia_elem_get_data(mowgli_patricia_elem_t *elem); | |
| | | | |
| unsigned int mowgli_patricia_size(mowgli_patricia_t *dict); | | unsigned int mowgli_patricia_size(mowgli_patricia_t *dict); | |
| void mowgli_patricia_stats(mowgli_patricia_t *dict, void (*cb)(const char *
line, void *privdata), void *privdata); | | void mowgli_patricia_stats(mowgli_patricia_t *dict, void (*cb)(const char *
line, void *privdata), void *privdata); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 16 lines changed or added | |
|