* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
- * © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
* commands_parser.c: hand-written parser to parse commands (commands are what
* you bind on keys and what you can send to i3 using the IPC interface, like
*/
static void push_criterion(void *unused_criteria, const char *type,
const char *value) {
- struct criterion *criterion = malloc(sizeof(struct criterion));
- criterion->type = strdup(type);
- criterion->value = strdup(value);
+ struct criterion *criterion = smalloc(sizeof(struct criterion));
+ criterion->type = sstrdup(type);
+ criterion->value = sstrdup(value);
TAILQ_INSERT_TAIL(&criteria, criterion, criteria);
}
if (*walk == beginning)
return NULL;
- char *str = scalloc(*walk - beginning + 1);
+ char *str = scalloc(*walk - beginning + 1, 1);
/* We copy manually to handle escaping of characters. */
int inpos, outpos;
for (inpos = 0, outpos = 0;
CommandResult *parse_command(const char *input, yajl_gen gen) {
DLOG("COMMAND: *%s*\n", input);
state = INITIAL;
- CommandResult *result = scalloc(sizeof(CommandResult));
+ CommandResult *result = scalloc(1, sizeof(CommandResult));
/* A YAJL JSON generator used for formatting replies. */
command_output.json_gen = gen;