diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/CMakeLists.txt | 7 | ||||
-rw-r--r-- | common/list.c | 10 | ||||
-rw-r--r-- | common/log.c | 5 |
3 files changed, 13 insertions, 9 deletions
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index a40f096d..38767249 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -6,3 +6,10 @@ add_library(sway-common readline.c stringop.c ) + +if(Backtrace_FOUND) + set_target_properties(sway-common + PROPERTIES + COMPILE_FLAGS "-include ${Backtrace_HEADER}" + ) +endif() diff --git a/common/list.c b/common/list.c index d6f6f2ea..850c8569 100644 --- a/common/list.c +++ b/common/list.c @@ -50,14 +50,8 @@ void list_cat(list_t *list, list_t *source) { } } -// pass the pointer of the object we care about to the comparison function -static int list_cmp(const void *l, const void *r, void *_cmp) { - int (*cmp)(const void *, const void *) = _cmp; - return cmp(*(void**)l, *(void**)r); -} - -void list_sort(list_t *list, int compare(const void *left, const void *right)) { - qsort_r(list->items, list->length, sizeof(void *), list_cmp, compare); +void list_qsort(list_t* list, int compare(const void *left, const void *right)) { + qsort(list->items, list->length, sizeof(void *), compare); } int list_seq_find(list_t *list, int compare(const void *item, const void *data), const void *data) { diff --git a/common/log.c b/common/log.c index 02aac4c1..f9242bf4 100644 --- a/common/log.c +++ b/common/log.c @@ -10,7 +10,6 @@ #include <errno.h> #include <string.h> #include <stringop.h> -#include <execinfo.h> int colored = 1; log_importance_t loglevel_default = L_ERROR; @@ -137,6 +136,7 @@ bool _sway_assert(bool condition, const char* format, ...) { } void error_handler(int sig) { +#if SWAY_Backtrace_FOUND int i; int max_lines = 20; void *array[max_lines]; @@ -155,5 +155,8 @@ void error_handler(int sig) { for (i = 0; (size_t)i < bt_len; i++) { sway_log(L_ERROR, "Backtrace: %s", bt[i]); } +#else + sway_log(L_ERROR, "Error: Signal %d.", sig); +#endif exit(1); } |