diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-02-01 02:29:04 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-02-01 02:29:04 -0500 |
commit | c172de371192102aeeac0b1e51ef9a8cb3c231a6 (patch) | |
tree | 16aa6509aa18955c854ca917d0a209cc859ac7b3 /libsbutil | |
parent | sandbox: declare all local funcs static (diff) | |
download | sandbox-c172de371192102aeeac0b1e51ef9a8cb3c231a6.tar.gz sandbox-c172de371192102aeeac0b1e51ef9a8cb3c231a6.tar.bz2 sandbox-c172de371192102aeeac0b1e51ef9a8cb3c231a6.zip |
libsbutil: cull more unused debug/string code
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsbutil')
-rw-r--r-- | libsbutil/include/rcscripts/util/debug.h | 36 | ||||
-rw-r--r-- | libsbutil/include/rcscripts/util/str_list.h | 72 |
2 files changed, 1 insertions, 107 deletions
diff --git a/libsbutil/include/rcscripts/util/debug.h b/libsbutil/include/rcscripts/util/debug.h index 8bc2371..db9671b 100644 --- a/libsbutil/include/rcscripts/util/debug.h +++ b/libsbutil/include/rcscripts/util/debug.h @@ -16,8 +16,6 @@ void rc_log_domain (const char *new_domain); -void -rc_debug_enabled (bool enabled); /* Using errno to try and create a debug system that will 'trace' from the * point the initial error occured, is highly messy and needs strict errno @@ -38,45 +36,13 @@ rc_errno_is_set (void); #define rc_errno_save() int _rc_old_errno = rc_errno_get (); #define rc_errno_restore() rc_errno_set (_rc_old_errno); -#define rc_errno_saved _rc_old_errno void debug_message (const char *file, const char *func, int line, const char *format, ...); #define DBG_MSG(_format, _arg...) \ - do { \ - debug_message (__FILE__, __func__, __LINE__, _format, ## _arg); \ - } while (0) - -#define FATAL_ERROR() \ - do { \ - save_errno (); \ - fprintf(stderr, "ERROR: file '%s', function '%s', line %i.\n", \ - __FILE__, __func__, __LINE__); \ - restore_errno (); \ - if (0 != errno) \ - { \ - perror("ERROR"); \ - } \ - exit(EXIT_FAILURE); \ - } while (0) - -#define NEG_FATAL_ERROR(_x) \ - do { \ - if (-1 == _x) \ - { \ - FATAL_ERROR(); \ - } \ - } while (0) - -#define NULL_FATAL_ERROR(_x) \ - do { \ - if (NULL == _x) \ - { \ - FATAL_ERROR(); \ - } \ - } while (0) + debug_message (__FILE__, __func__, __LINE__, _format, ## _arg) /* * Functions to check validity of some types. diff --git a/libsbutil/include/rcscripts/util/str_list.h b/libsbutil/include/rcscripts/util/str_list.h index ac287db..3b5b93d 100644 --- a/libsbutil/include/rcscripts/util/str_list.h +++ b/libsbutil/include/rcscripts/util/str_list.h @@ -130,48 +130,6 @@ } while (NULL != _str_p1); \ } while (0) -/* Delete one entry from the string list, and shift the rest down if the entry - * was not at the end. For now we do not resize the amount of entries the - * string list can contain, and free the memory for the matching item */ -#define str_list_del_item(_string_list, _item, _error) \ - do { \ - int _i = 0; \ - if (!check_str (_item)) \ - { \ - goto _error; \ - } \ - if (NULL == _string_list) \ - { \ - rc_errno_set (EINVAL); \ - DBG_MSG ("Invalid string list passed!\n"); \ - goto _error; \ - } \ - while (NULL != _string_list[_i]) \ - { \ - if (0 == strcmp (_item, _string_list[_i])) \ - { \ - break; \ - } \ - else \ - { \ - _i++; \ - } \ - } \ - if (NULL == _string_list[_i]) \ - { \ - rc_errno_set (EINVAL); \ - DBG_MSG ("Invalid string list item passed!\n"); \ - goto _error; \ - } \ - free (_string_list[_i]); \ - /* Shift all the following items one forward */ \ - do { \ - _string_list[_i] = _string_list[_i+1]; \ - /* This stupidity is to shutup gcc */ \ - _i++; \ - } while (NULL != _string_list[_i]); \ - } while (0) - /* Step through each entry in the string list, setting '_pos' to the * beginning of the entry. '_counter' is used by the macro as index, * but should not be used by code as index (or if really needed, then @@ -181,36 +139,6 @@ if ((NULL != _string_list) && (0 == (_counter = 0))) \ while (NULL != (_pos = _string_list[_counter++])) -/* Same as above (with the same warning about '_counter'). Now we just - * have '_next' that are also used for indexing. Once again rather refrain - * from using it if not absolutely needed. The major difference to above, - * is that it should be safe from having the item removed from under you. */ -#define str_list_for_each_item_safe(_string_list, _pos, _next, _counter) \ - if ((NULL != _string_list) && (0 == (_counter = 0))) \ - /* First part of the while checks if this is the - * first loop, and if so setup _pos and _next - * and increment _counter */ \ - while ((((0 == _counter) \ - && (NULL != (_pos = _string_list[_counter])) \ - && (_pos != (_next = _string_list[++_counter]))) \ - /* Second part is when it is not the first loop - * and _pos was not removed from under us. We - * just increment _counter, and setup _pos and - * _next */ \ - || ((0 != _counter) \ - && (_pos == _string_list[_counter-1]) \ - && (_next == _string_list[_counter]) \ - && (NULL != (_pos = _string_list[_counter])) \ - && (_pos != (_next = _string_list[++_counter]))) \ - /* Last part is when _pos was removed from under - * us. We basically just setup _pos and _next, - * but leave _counter alone */ \ - || ((0 != _counter) \ - && (_pos != _string_list[_counter-1]) \ - && (_next == _string_list[_counter-1]) \ - && (NULL != (_pos = _string_list[_counter-1])) \ - && (_pos != (_next = _string_list[_counter]))))) - /* Just free the whole string list */ #define str_list_free(_string_list) \ do { \ |