diff options
| author | rillig <rillig@NetBSD.org> | 2021-08-15 22:22:52 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2021-08-15 22:22:52 +0000 |
| commit | 8a2217467d3681583ddbbe285ad406e5d2d9c7b2 (patch) | |
| tree | a0a5c6c68553a8c066bf84252618e39f89192625 /lib/libedit | |
| parent | 5635c3c91aea9690c4b1c33dc0d8813b5fdbab2f (diff) | |
libedit: simplify calls to macro ADD_STRING
The lint comments CONSTCOND and LINTED were not necessary. It is
simpler to just specify what to free. GCC optimizes free(NULL) to be a
no-op.
No functional change.
Diffstat (limited to 'lib/libedit')
| -rw-r--r-- | lib/libedit/readline.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index bf963b61807..6bcb6cddbbf 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $NetBSD: readline.c,v 1.161 2021/08/15 22:14:45 rillig Exp $ */ +/* $NetBSD: readline.c,v 1.162 2021/08/15 22:22:52 rillig Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: readline.c,v 1.161 2021/08/15 22:14:45 rillig Exp $"); +__RCSID("$NetBSD: readline.c,v 1.162 2021/08/15 22:22:52 rillig Exp $"); #endif /* not lint && not SCCSID */ #include <sys/types.h> @@ -951,10 +951,7 @@ history_expand(char *str, char **output) (size += len + 1) * sizeof(*nresult)); \ if (nresult == NULL) { \ el_free(*output); \ - if (/*CONSTCOND*/fr) { \ - /*LINTED*/ \ - el_free(tmp); \ - } \ + el_free(fr); \ return 0; \ } \ result = nresult; \ @@ -1004,11 +1001,11 @@ loop: goto loop; } len = i - start; - ADD_STRING(&str[start], len, 0); + ADD_STRING(&str[start], len, NULL); if (str[i] == '\0' || str[i] != history_expansion_char) { len = j - i; - ADD_STRING(&str[i], len, 0); + ADD_STRING(&str[i], len, NULL); if (start == 0) ret = 0; else @@ -1018,7 +1015,7 @@ loop: ret = _history_expand_command (str, i, (j - i), &tmp); if (ret > 0 && tmp) { len = strlen(tmp); - ADD_STRING(tmp, len, 1); + ADD_STRING(tmp, len, tmp); } if (tmp) { el_free(tmp); |
