From: Jonathan Neuschäfer Date: Sat, 24 Dec 2011 17:28:04 +0000 (+0100) Subject: screen_keydef: get rid of the BUFSIZE constant X-Git-Tag: release-0.20~22 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7aba9bcc752bb63d9a874e6a8a20cd20ddb7e211;p=ncmpc.git screen_keydef: get rid of the BUFSIZE constant It was only used in one function. Use sizeof(buf) instead. --- 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]);