From 7aba9bcc752bb63d9a874e6a8a20cd20ddb7e211 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonathan=20Neusch=C3=A4fer?= Date: Sat, 24 Dec 2011 18:28:04 +0100 Subject: [PATCH] screen_keydef: get rid of the BUFSIZE constant It was only used in one function. Use sizeof(buf) instead. --- src/screen_keydef.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 800e54f..0f46eee 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -33,7 +33,6 @@ #define STATIC_ITEMS 0 #define STATIC_SUB_ITEMS 1 -#define BUFSIZE 256 #define LIST_ITEM_APPLY() ((unsigned)command_list_length) #define LIST_ITEM_SAVE() (LIST_ITEM_APPLY()+1) @@ -203,7 +202,7 @@ assign_new_key(int cmd_index, int key_index) static const char * list_callback(unsigned idx, G_GNUC_UNUSED void *data) { - static char buf[BUFSIZE]; + static char buf[256]; if (subcmd < 0) { if (idx == LIST_ITEM_APPLY()) @@ -219,15 +218,15 @@ list_callback(unsigned idx, G_GNUC_UNUSED void *data) return "[..]"; idx--; if (idx == subcmd_addpos) { - g_snprintf(buf, BUFSIZE, "%d. %s", + g_snprintf(buf, sizeof(buf), "%d. %s", idx + 1, _("Add new key")); return buf; } assert(idx < MAX_COMMAND_KEYS && cmds[subcmd].keys[idx] > 0); - g_snprintf(buf, - BUFSIZE, "%d. %-20s (%d) ", + g_snprintf(buf, sizeof(buf), + "%d. %-20s (%d) ", idx + 1, key2str(cmds[subcmd].keys[idx]), cmds[subcmd].keys[idx]); -- 2.30.2