mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
The menu already limits entries with MENU_MAXENTRY, so don't bother
holding a command name limit as well.
This commit is contained in:
parent
fd827fd757
commit
0a71742af4
3
calmwm.h
3
calmwm.h
@ -260,8 +260,7 @@ TAILQ_HEAD(mousebinding_q, binding);
|
||||
|
||||
struct cmd {
|
||||
TAILQ_ENTRY(cmd) entry;
|
||||
#define CMD_MAXNAMELEN 256
|
||||
char name[CMD_MAXNAMELEN];
|
||||
char *name;
|
||||
char path[MAXPATHLEN];
|
||||
};
|
||||
TAILQ_HEAD(cmd_q, cmd);
|
||||
|
10
conf.c
10
conf.c
@ -51,13 +51,11 @@ conf_cmd_add(struct conf *c, const char *name, const char *path)
|
||||
sizeof(c->lockpath))
|
||||
return (0);
|
||||
} else {
|
||||
cmd = xmalloc(sizeof(*cmd));
|
||||
|
||||
conf_cmd_remove(c, name);
|
||||
|
||||
if (strlcpy(cmd->name, name, sizeof(cmd->name)) >=
|
||||
sizeof(cmd->name))
|
||||
return (0);
|
||||
cmd = xmalloc(sizeof(*cmd));
|
||||
|
||||
cmd->name = xstrdup(name);
|
||||
if (strlcpy(cmd->path, path, sizeof(cmd->path)) >=
|
||||
sizeof(cmd->path))
|
||||
return (0);
|
||||
@ -74,6 +72,7 @@ conf_cmd_remove(struct conf *c, const char *name)
|
||||
TAILQ_FOREACH_SAFE(cmd, &c->cmdq, entry, cmdnxt) {
|
||||
if (strcmp(cmd->name, name) == 0) {
|
||||
TAILQ_REMOVE(&c->cmdq, cmd, entry);
|
||||
free(cmd->name);
|
||||
free(cmd);
|
||||
}
|
||||
}
|
||||
@ -291,6 +290,7 @@ conf_clear(struct conf *c)
|
||||
|
||||
while ((cmd = TAILQ_FIRST(&c->cmdq)) != NULL) {
|
||||
TAILQ_REMOVE(&c->cmdq, cmd, entry);
|
||||
free(cmd->name);
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user