From: Paul Eggert Date: Sun, 24 May 2015 21:20:09 +0000 (-0700) Subject: etags.c: avoid side effects in 'if' X-Git-Tag: emacs-25.0.90~1989 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3441b0cc61d88edb921bbf27462f3f961e794b4d;p=emacs.git etags.c: avoid side effects in 'if' * lib-src/etags.c (process_file_name, Perl_functions) (TEX_decode_env): Hoist side effects into previous statement. --- diff --git a/lib-src/etags.c b/lib-src/etags.c index f049f42b442..ea337d41008 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -1484,15 +1484,16 @@ process_file_name (char *file, language *lang) error ("skipping inclusion of %s in self.", file); return; } - if ((compr = get_compressor_from_suffix (file, &ext)) == NULL) + compr = get_compressor_from_suffix (file, &ext); + if (compr) { - compressed_name = NULL; - real_name = uncompressed_name = savestr (file); + real_name = compressed_name = savestr (file); + uncompressed_name = savenstr (file, ext - file); } else { - real_name = compressed_name = savestr (file); - uncompressed_name = savenstr (file, ext - file); + compressed_name = NULL; + real_name = uncompressed_name = savestr (file); } /* If the canonicalized uncompressed name @@ -4299,8 +4300,8 @@ Perl_functions (FILE *inf) cp++; if (cp == sp) continue; /* nothing found */ - if ((pos = strchr (sp, ':')) != NULL - && pos < cp && pos[1] == ':') + pos = strchr (sp, ':'); + if (pos && pos < cp && pos[1] == ':') /* The name is already qualified. */ make_tag (sp, cp - sp, true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); @@ -5051,8 +5052,8 @@ TEX_decode_env (const char *evarname, const char *defenv) env = concat (env, defenv, ""); /* Allocate a token table */ - for (len = 1, p = env; p;) - if ((p = strchr (p, ':')) && *++p != '\0') + for (len = 1, p = env; (p = strchr (p, ':')); ) + if (*++p) len++; TEX_toktab = xnew (len, linebuffer);