From 88b91e33415971e73143968a670e731b6ce365c1 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Thu, 14 Feb 2019 13:44:07 +0100 Subject: [PATCH] common: Remove unused macros Change-Id: Ic72bd40be1423875e3f1a7f449a167b7ffd5a266 --- src/common/macro.h | 63 +----------------------------------------------------- 1 file changed, 1 insertion(+), 62 deletions(-) diff --git a/src/common/macro.h b/src/common/macro.h index 0969c4e..cad7aa9 100644 --- a/src/common/macro.h +++ b/src/common/macro.h @@ -27,12 +27,6 @@ #ifndef _RESOURCED_MACRO_H_ #define _RESOURCED_MACRO_H_ -#define execute_once \ - static int __func__##guardian; \ - for (; \ - __func__##guardian == 0; \ - __func__##guardian = 1) - #include #include #include @@ -41,18 +35,9 @@ #define API __attribute__((visibility("default"))) #endif -#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) - -#define DECLARE_WRAPPER(fn_name, inner_fn) \ - static void fn_name(void *data, void __attribute__((__unused__)) *not_used) \ - { \ - return inner_fn(data); \ - } - #define UNUSED __attribute__((__unused__)) -#define MAX_SIZE2(a, b) sizeof(a) + sizeof(b) - 1 -#define MAX_SIZE3(a, b, c) MAX_SIZE2(a, b) + sizeof(c) - 1 +#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) /* * One byte digit has 3 position in decimal representation @@ -100,13 +85,6 @@ } \ } while (0) -#define ret_value_secure_msg_if(expr, val, fmt, arg...) do { \ - if (expr) { \ - _SE(fmt, ##arg); \ - return val; \ - } \ -} while (0) - #define ret_value_errno_msg_if(expr, val, fmt, arg...) do { \ if (expr) { \ ETRACE_ERRNO_MSG(fmt, ##arg); \ @@ -114,38 +92,6 @@ } \ } while (0) -/* - * @brief Copy from source to destination - * destination should not be on heap. - * Destination will be null terminated - */ -#define STRING_SAVE_COPY(destination, source) do { \ - if (destination && source) { \ - size_t null_pos = strlen(source); \ - strncpy(destination, source, sizeof(destination)); \ - null_pos = sizeof(destination) - 1 < null_pos ? \ - sizeof(destination) - 1 : null_pos; \ - destination[null_pos] = '\0'; \ - } \ -} while (0) - -/* FIXME: Do we really need pointers? */ -#define array_foreach(key, type, array) \ - guint _array_foreach_index; \ - type *key; \ - for (_array_foreach_index = 0; \ - array && _array_foreach_index < array->len && \ - (key = &g_array_index(array, type, _array_foreach_index)); \ - ++_array_foreach_index) - -#define slist_foreach(key, type, list) \ - type *key; \ - GSList *_slist_foreach_copy_list = list; \ - for (; \ - _slist_foreach_copy_list && \ - ((key = _slist_foreach_copy_list->data) || 1); \ - _slist_foreach_copy_list = _slist_foreach_copy_list->next) - #define gslist_for_each_item(item, list) \ for (item = list; item != NULL; item = g_slist_next(item)) @@ -157,13 +103,6 @@ elem && ((node = elem->data) != NULL); \ elem = elem_next, elem_next = g_slist_next(elem), node = NULL) -#define DB_ACTION(command) do { \ - if ((command) != SQLITE_OK) { \ - error_code = RESOURCED_ERROR_DB_FAILED; \ - goto handle_error; \ - } \ -} while (0) - #define MODULE_REGISTER(module) \ static void __attribute__ ((constructor)) module_init(void) \ { \ -- 2.7.4