Fix "map" processing in config files.
Trying to calculate the size of an extern array at runtime is fatal -- it's also going to either evaluate to zero (if passed by pointer) or fail at compilation, because sizeof is compile-time only. Therefore, give the commands[] array a pre-calculated size -- which can then be used properly when trying to set any "map" lines encountered in Vimprobable's config file.
This commit is contained in:
parent
da5394a5c4
commit
304ff1796b
2
config.h
2
config.h
|
@ -83,7 +83,7 @@ static Searchengine searchengines[] = {
|
|||
static Searchengine *defsearch = &searchengines[0];
|
||||
|
||||
/* command mapping */
|
||||
Command commands[] = {
|
||||
Command commands[COMMANDSIZE] = {
|
||||
/* command, function, argument */
|
||||
{ "ba", navigate, {NavigationBack} },
|
||||
{ "back", navigate, {NavigationBack} },
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "utilities.h"
|
||||
|
||||
extern char commandhistory[COMMANDHISTSIZE][255];
|
||||
extern Command *commands;
|
||||
extern Command commands[COMMANDSIZE];
|
||||
extern int lastcommand, maxcommands, commandpointer;
|
||||
extern KeyList *keylistroot;
|
||||
extern Key keys[];
|
||||
|
|
|
@ -168,5 +168,8 @@ typedef struct {
|
|||
#define HISTORY_STORAGE_FILENAME "%s/.config/vimprobable/history", getenv("HOME")
|
||||
#define CLOSED_URL_FILENAME "%s/.config/vimprobable/closed", getenv("HOME")
|
||||
|
||||
/* Command size */
|
||||
#define COMMANDSIZE 1024
|
||||
|
||||
/* completion list size */
|
||||
#define MAX_LIST_SIZE 40
|
||||
|
|
Loading…
Reference in New Issue