Skip to content

Commit

Permalink
cleanup: remove an accidental VLA
Browse files Browse the repository at this point in the history
We don't use these in Toxic
  • Loading branch information
JFreegman committed Feb 1, 2024
1 parent 78c5b7d commit e8260ce
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
*/

#include <assert.h>
#include <ctype.h>
#include <libconfig.h>
#include <stdlib.h>
Expand All @@ -46,6 +47,11 @@
#define PACKAGE_DATADIR "."
#endif

#define TOXIC_CONF_FILE_EXT ".conf"
#define TOXIC_CONF_FILE_EXT_LENGTH (sizeof(TOXIC_CONF_FILE_EXT) - 1)

static_assert(MAX_STR_SIZE > TOXIC_CONF_FILE_EXT_LENGTH, "MAX_STR_SIZE <= TOXIC_CONF_FILE_EXT_LENGTH");

#define NO_SOUND "silent"

static struct ui_strings {
Expand Down Expand Up @@ -341,16 +347,14 @@ static void set_key_binding(int *key, const char **bind)
}
}

#define TOXIC_CONF_FILE_EXT ".conf"

bool settings_load_config_file(Run_Options *run_opts, const char *data_path)
{
char tmp_path[MAX_STR_SIZE] = {0};

if (run_opts->use_custom_config_file) {
snprintf(tmp_path, sizeof(tmp_path), "%s", run_opts->config_path);
} else if (run_opts->use_custom_data) {
char tmp_data[MAX_STR_SIZE - strlen(TOXIC_CONF_FILE_EXT)];
char tmp_data[MAX_STR_SIZE - TOXIC_CONF_FILE_EXT_LENGTH];

if (strlen(data_path) >= sizeof(tmp_data)) {
return false;
Expand Down

0 comments on commit e8260ce

Please sign in to comment.