specifier: minor modernizations

This commit is contained in:
Lennart Poettering 2012-11-14 22:15:35 +01:00
parent 0290296582
commit 7ae03f3697
1 changed files with 6 additions and 3 deletions

View File

@ -41,7 +41,8 @@ char *specifier_printf(const char *text, const Specifier table[], void *userdata
assert(table); assert(table);
l = strlen(text); l = strlen(text);
if (!(r = new(char, l+1))) r = new(char, l+1);
if (!r)
return NULL; return NULL;
t = r; t = r;
@ -62,7 +63,8 @@ char *specifier_printf(const char *text, const Specifier table[], void *userdata
char *n, *w; char *n, *w;
size_t k, j; size_t k, j;
if (!(w = i->lookup(i->specifier, i->data, userdata))) { w = i->lookup(i->specifier, i->data, userdata);
if (!w) {
free(r); free(r);
return NULL; return NULL;
} }
@ -70,7 +72,8 @@ char *specifier_printf(const char *text, const Specifier table[], void *userdata
j = t - r; j = t - r;
k = strlen(w); k = strlen(w);
if (!(n = new(char, j + k + l + 1))) { n = new(char, j + k + l + 1);
if (!n) {
free(r); free(r);
free(w); free(w);
return NULL; return NULL;