From 01159b29f009977da975ff8c2d648ec0d2881e40 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Fri, 21 Apr 2017 09:37:03 +0200 Subject: [PATCH] [Mode] Make the name field a pointer instead of a fixed 32char array. --- include/mode-private.h | 4 ++-- source/dialogs/script.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/mode-private.h b/include/mode-private.h index 97a17fa2..b22eccf0 100644 --- a/include/mode-private.h +++ b/include/mode-private.h @@ -31,7 +31,7 @@ #include /** ABI version to check if loaded plugin is compatible. */ -#define ABI_VERSION 0x00000004 +#define ABI_VERSION 0x00000005 /** * @param data Pointer to #Mode object. @@ -143,7 +143,7 @@ struct rofi_mode /** Used for external plugins. */ unsigned int abi_version; /** Name (max 31 char long) */ - char name[32]; + char *name; char cfg_name_key[128]; char *display_name; diff --git a/source/dialogs/script.c b/source/dialogs/script.c index b2fd1fd9..566ca8b5 100644 --- a/source/dialogs/script.c +++ b/source/dialogs/script.c @@ -91,6 +91,7 @@ static void script_switcher_free ( Mode *sw ) if ( sw == NULL ) { return; } + g_free ( sw->name ); g_free ( sw->ed ); g_free ( sw ); } @@ -182,7 +183,7 @@ Mode *script_switcher_parse_setup ( const char *str ) const char *const sep = ":"; for ( char *token = strtok_r ( parse, sep, &endp ); token != NULL; token = strtok_r ( NULL, sep, &endp ) ) { if ( index == 0 ) { - g_strlcpy ( sw->name, token, 32 ); + sw->name = g_strdup ( token ); } else if ( index == 1 ) { sw->ed = (void *) rofi_expand_path ( token ); @@ -203,7 +204,7 @@ Mode *script_switcher_parse_setup ( const char *str ) return sw; } - g_warning ( "The script command '%s' has %u options, but needs 2: :