diff options
Diffstat (limited to 'apps/shortcuts.c')
-rw-r--r-- | apps/shortcuts.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 3f13d0c1b3..2e10bad00f 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c | |||
@@ -128,8 +128,7 @@ static struct shortcut* get_shortcut(int index) | |||
128 | 128 | ||
129 | if (first_handle == 0) | 129 | if (first_handle == 0) |
130 | { | 130 | { |
131 | first_handle = core_alloc_ex("shortcuts_head", | 131 | first_handle = core_alloc_ex(sizeof(struct shortcut_handle), &shortcut_ops); |
132 | sizeof(struct shortcut_handle), &shortcut_ops); | ||
133 | if (first_handle <= 0) | 132 | if (first_handle <= 0) |
134 | return NULL; | 133 | return NULL; |
135 | h = core_get_data(first_handle); | 134 | h = core_get_data(first_handle); |
@@ -146,11 +145,9 @@ static struct shortcut* get_shortcut(int index) | |||
146 | } while (handle_count > 0 && current_handle > 0); | 145 | } while (handle_count > 0 && current_handle > 0); |
147 | if (handle_count > 0 && handle_index == 0) | 146 | if (handle_count > 0 && handle_index == 0) |
148 | { | 147 | { |
149 | char buf[32]; | ||
150 | snprintf(buf, sizeof buf, "shortcuts_%d", index/SHORTCUTS_PER_HANDLE); | ||
151 | /* prevent invalidation of 'h' during compaction */ | 148 | /* prevent invalidation of 'h' during compaction */ |
152 | ++buflib_move_lock; | 149 | ++buflib_move_lock; |
153 | h->next_handle = core_alloc_ex(buf, sizeof(struct shortcut_handle), &shortcut_ops); | 150 | h->next_handle = core_alloc_ex(sizeof(struct shortcut_handle), &shortcut_ops); |
154 | --buflib_move_lock; | 151 | --buflib_move_lock; |
155 | if (h->next_handle <= 0) | 152 | if (h->next_handle <= 0) |
156 | return NULL; | 153 | return NULL; |
@@ -390,7 +387,7 @@ void shortcuts_init(void) | |||
390 | fd = open_utf8(SHORTCUTS_FILENAME, O_RDONLY); | 387 | fd = open_utf8(SHORTCUTS_FILENAME, O_RDONLY); |
391 | if (fd < 0) | 388 | if (fd < 0) |
392 | return; | 389 | return; |
393 | first_handle = core_alloc_ex("shortcuts_head", sizeof(struct shortcut_handle), &shortcut_ops); | 390 | first_handle = core_alloc_ex(sizeof(struct shortcut_handle), &shortcut_ops); |
394 | if (first_handle <= 0) { | 391 | if (first_handle <= 0) { |
395 | close(fd); | 392 | close(fd); |
396 | return; | 393 | return; |