X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Futil.c;h=3a855c1be48e5f97e9f8bc6d476cc09a7b5d5aea;hb=54ecda32c60c6f2548f74703bfd324694393edaa;hp=e9869ea4fad3bfd3695d41a6de7059db6deedfed;hpb=3ce4fad8f548db9edb19869ea540e3192d2123f4;p=elogind.git diff --git a/src/util.c b/src/util.c index e9869ea4f..3a855c1be 100644 --- a/src/util.c +++ b/src/util.c @@ -892,7 +892,7 @@ int load_env_file( char ***rl) { FILE *f; - char **m = 0; + char **m = NULL; int r; assert(fname); @@ -1833,7 +1833,8 @@ char *cunescape_length(const char *s, size_t length) { /* Undoes C style string escaping */ - if (!(r = new(char, length+1))) + r = new(char, length+1); + if (!r) return r; for (f = s, t = r; f < s + length; f++) { @@ -1887,8 +1888,10 @@ char *cunescape_length(const char *s, size_t length) { /* hexadecimal encoding */ int a, b; - if ((a = unhexchar(f[1])) < 0 || - (b = unhexchar(f[2])) < 0) { + a = unhexchar(f[1]); + b = unhexchar(f[2]); + + if (a < 0 || b < 0) { /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = 'x'; @@ -1911,9 +1914,11 @@ char *cunescape_length(const char *s, size_t length) { /* octal encoding */ int a, b, c; - if ((a = unoctchar(f[0])) < 0 || - (b = unoctchar(f[1])) < 0 || - (c = unoctchar(f[2])) < 0) { + a = unoctchar(f[0]); + b = unoctchar(f[1]); + c = unoctchar(f[2]); + + if (a < 0 || b < 0 || c < 0) { /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = f[0]; @@ -4177,7 +4182,7 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid) { } -void freeze(void) { +_noreturn_ void freeze(void) { /* Make sure nobody waits for us on a socket anymore */ close_all_fds(NULL, 0);