diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-10-13 11:27:13 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-10-13 11:27:13 +0300 |
commit | 0485d6bfe2417a7640ef95c9de6f48e1f35003fd (patch) | |
tree | f26c8a24a4a12bf9be5038f40e6a20a4f6e9aa79 /builtin.c | |
parent | 7504a8fbc86b327ad07c79c943b8fe2d253f256d (diff) | |
parent | 2a8c128ca91b42261720368e5d25431ee4362c70 (diff) | |
download | egawk-0485d6bfe2417a7640ef95c9de6f48e1f35003fd.tar.gz egawk-0485d6bfe2417a7640ef95c9de6f48e1f35003fd.tar.bz2 egawk-0485d6bfe2417a7640ef95c9de6f48e1f35003fd.zip |
Merge branch 'master' into cmake
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1569,7 +1569,7 @@ mpf1: s0 = s1; break; default: - if (do_lint && isalpha(cs1)) + if (do_lint && is_alpha(cs1)) lintwarn(_("ignoring unknown format specifier character `%c': no argument converted"), cs1); break; } @@ -1759,7 +1759,14 @@ do_substr(int nargs) else if (do_lint == DO_LINT_INVALID && ! (d_length >= 0)) lintwarn(_("substr: length %g is not >= 0"), d_length); DEREF(t1); - return dupnode(Nnull_string); + /* + * Return explicit null string instead of doing + * dupnode(Nnull_string) so that if the result + * is checked with the combination of length() + * and lint, no error is reported about using + * an uninitialized value. Same thing later, too. + */ + return make_string("", 0); } if (do_lint) { if (double_to_int(d_length) != d_length) @@ -1813,7 +1820,7 @@ do_substr(int nargs) if (do_lint && (do_lint == DO_LINT_ALL || ((indx | length) != 0))) lintwarn(_("substr: source string is zero length")); DEREF(t1); - return dupnode(Nnull_string); + return make_string("", 0); } /* get total len of input string, for following checks */ @@ -1830,7 +1837,7 @@ do_substr(int nargs) lintwarn(_("substr: start index %g is past end of string"), d_index); DEREF(t1); - return dupnode(Nnull_string); + return make_string("", 0); } if (length > src_len - indx) { if (do_lint) |