1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-01 10:46:45 +02:00

cleanup/error checks

This commit is contained in:
Jfreegman
2014-07-17 03:35:18 -04:00
parent b5f34f42a8
commit e61d070def
4 changed files with 34 additions and 20 deletions

View File

@ -235,9 +235,13 @@ int complete_line(ChatContext *ctx, const void *list, int n_items, int size)
snprintf(tmp, sizeof(tmp), "%s", ubuf);
tmp[ctx->pos] = '\0';
const char *s = strrchr(tmp, ' ');
char *sub = malloc(strlen(ubuf) + 1);
int n_endchrs = 1; /* 1 = append space to end of match, 2 = append ": " */
char *sub = malloc(strlen(ubuf) + 1);
if (sub == NULL)
exit_toxic_err("failed in complete_line", FATALERR_MEMORY);
if (!s) {
strcpy(sub, tmp);