diff options
author | 2015-12-21 20:42:08 -0500 | |
---|---|---|
committer | 2015-12-21 20:42:08 -0500 | |
commit | 91c102a897467ff1bae345458ccf096e32e7bd15 (patch) | |
tree | 104c612d08afef1566c9b56f962641bb39c0dc1b /sway | |
parent | Merge pull request #391 from mikkeloscar/trigger-workspace-ipc (diff) | |
parent | replace non-standard qsort_r with qsort (diff) | |
download | sway-91c102a897467ff1bae345458ccf096e32e7bd15.tar.gz sway-91c102a897467ff1bae345458ccf096e32e7bd15.tar.zst sway-91c102a897467ff1bae345458ccf096e32e7bd15.zip |
Merge pull request #393 from robotanarchy/musl-libc-compatibility
musl libc compatibility
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 12 | ||||
-rw-r--r-- | sway/config.c | 8 | ||||
-rw-r--r-- | sway/debug_log.c | 1 |
3 files changed, 14 insertions, 7 deletions
diff --git a/sway/commands.c b/sway/commands.c index 93c74915..b1b1c5b6 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -220,7 +220,7 @@ static struct cmd_results *cmd_bindsym(int argc, char **argv) { | |||
220 | } | 220 | } |
221 | binding->order = binding_order++; | 221 | binding->order = binding_order++; |
222 | list_add(mode->bindings, binding); | 222 | list_add(mode->bindings, binding); |
223 | list_sort(mode->bindings, sway_binding_cmp); | 223 | list_qsort(mode->bindings, sway_binding_cmp_qsort); |
224 | 224 | ||
225 | sway_log(L_DEBUG, "bindsym - Bound %s to command %s", argv[0], binding->command); | 225 | sway_log(L_DEBUG, "bindsym - Bound %s to command %s", argv[0], binding->command); |
226 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 226 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
@@ -1266,9 +1266,9 @@ static struct cmd_results *cmd_scratchpad(int argc, char **argv) { | |||
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | // sort in order of longest->shortest | 1268 | // sort in order of longest->shortest |
1269 | static int compare_set(const void *_l, const void *_r) { | 1269 | static int compare_set_qsort(const void *_l, const void *_r) { |
1270 | struct sway_variable const *l = _l; | 1270 | struct sway_variable const *l = *(void **)_l; |
1271 | struct sway_variable const *r = _r; | 1271 | struct sway_variable const *r = *(void **)_r; |
1272 | return strlen(r->name) - strlen(l->name); | 1272 | return strlen(r->name) - strlen(l->name); |
1273 | } | 1273 | } |
1274 | 1274 | ||
@@ -1295,7 +1295,7 @@ static struct cmd_results *cmd_set(int argc, char **argv) { | |||
1295 | var = malloc(sizeof(struct sway_variable)); | 1295 | var = malloc(sizeof(struct sway_variable)); |
1296 | var->name = strdup(argv[0]); | 1296 | var->name = strdup(argv[0]); |
1297 | list_add(config->symbols, var); | 1297 | list_add(config->symbols, var); |
1298 | list_sort(config->symbols, compare_set); | 1298 | list_qsort(config->symbols, compare_set_qsort); |
1299 | } | 1299 | } |
1300 | var->value = join_args(argv + 1, argc - 1); | 1300 | var->value = join_args(argv + 1, argc - 1); |
1301 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 1301 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
@@ -1631,7 +1631,7 @@ static struct cmd_results *bar_cmd_bindsym(int argc, char **argv) { | |||
1631 | list_del(bar->bindings, i); | 1631 | list_del(bar->bindings, i); |
1632 | } | 1632 | } |
1633 | list_add(bar->bindings, binding); | 1633 | list_add(bar->bindings, binding); |
1634 | list_sort(bar->bindings, sway_mouse_binding_cmp); | 1634 | list_qsort(bar->bindings, sway_mouse_binding_cmp_qsort); |
1635 | 1635 | ||
1636 | sway_log(L_DEBUG, "bindsym - Bound %s to command %s when clicking swaybar", argv[0], binding->command); | 1636 | sway_log(L_DEBUG, "bindsym - Bound %s to command %s when clicking swaybar", argv[0], binding->command); |
1637 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 1637 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
diff --git a/sway/config.c b/sway/config.c index 257bb872..853a7111 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -642,6 +642,10 @@ int sway_binding_cmp(const void *a, const void *b) { | |||
642 | return lenient_strcmp(binda->command, bindb->command); | 642 | return lenient_strcmp(binda->command, bindb->command); |
643 | } | 643 | } |
644 | 644 | ||
645 | int sway_binding_cmp_qsort(const void *a, const void *b) { | ||
646 | return sway_binding_cmp(*(void **)a, *(void **)b); | ||
647 | } | ||
648 | |||
645 | void free_sway_binding(struct sway_binding *binding) { | 649 | void free_sway_binding(struct sway_binding *binding) { |
646 | if (binding->keys) { | 650 | if (binding->keys) { |
647 | for (int i = 0; i < binding->keys->length; i++) { | 651 | for (int i = 0; i < binding->keys->length; i++) { |
@@ -675,6 +679,10 @@ int sway_mouse_binding_cmp(const void *a, const void *b) { | |||
675 | return lenient_strcmp(binda->command, bindb->command); | 679 | return lenient_strcmp(binda->command, bindb->command); |
676 | } | 680 | } |
677 | 681 | ||
682 | int sway_mouse_binding_cmp_qsort(const void *a, const void *b) { | ||
683 | return sway_mouse_binding_cmp(*(void **)a, *(void **)b); | ||
684 | } | ||
685 | |||
678 | void free_sway_mouse_binding(struct sway_mouse_binding *binding) { | 686 | void free_sway_mouse_binding(struct sway_mouse_binding *binding) { |
679 | if (binding->command) { | 687 | if (binding->command) { |
680 | free(binding->command); | 688 | free(binding->command); |
diff --git a/sway/debug_log.c b/sway/debug_log.c index 8b30ed45..6fd6422f 100644 --- a/sway/debug_log.c +++ b/sway/debug_log.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <errno.h> | 10 | #include <errno.h> |
11 | #include <string.h> | 11 | #include <string.h> |
12 | #include <stringop.h> | 12 | #include <stringop.h> |
13 | #include <execinfo.h> | ||
14 | #include "workspace.h" | 13 | #include "workspace.h" |
15 | 14 | ||
16 | extern log_importance_t v; | 15 | extern log_importance_t v; |