if (s == NULL) /* invalid, though! */
return NULL;
/* make a copy to store the parsed string */
- if (!(dup = strdup(s)))
+ if (!(dup = ast_strdup(s)))
return NULL;
cur = dup;
char *dup;
int tws;
- if (!(dup = parse_args(s, &x, argv, sizeof(argv) / sizeof(argv[0]), &tws))) {
- ast_log(LOG_ERROR, "Memory allocation failure\n");
+ if (!(dup = parse_args(s, &x, argv, sizeof(argv) / sizeof(argv[0]), &tws)))
return -1;
- }
/* We need at least one entry, or ignore */
if (x > 0) {
}
} else
ast_cli(fd, "No such command '%s' (type 'help' for help)\n", find_best(argv));
- if (e) {
- AST_LIST_LOCK(&helpers);
- e->inuse--; /* XXX here an atomic dec would suffice */
- AST_LIST_UNLOCK(&helpers);
- }
+ if (e)
+ ast_atomic_fetchadd_int(&e->inuse, -1);
}
free(dup);