Add assertions and shuffle code around for LLVM+Clang scan-build.

This commit is contained in:
tg
2012-12-04 01:18:34 +00:00
parent 68c4dae6ef
commit cf807eb83a
9 changed files with 46 additions and 27 deletions

View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.231 2012/12/01 01:36:23 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.232 2012/12/04 01:18:28 tg Exp $");
#if HAVE_KILLPG
/*
@ -852,8 +852,6 @@ c_typeset(const char **wp)
} else if (wp[builtin_opt.optind]) {
for (i = builtin_opt.optind; wp[i]; i++) {
varsearch(e->loc, &vp, wp[i], hash(wp[i]));
if (!vp)
continue;
c_typeset_vardump(vp, flag, thing, pflag, istset);
}
} else
@ -883,6 +881,9 @@ c_typeset_vardump(struct tbl *vp, uint32_t flag, int thing, bool pflag,
int any_set = 0;
char *s;
if (!vp)
return;
/*
* See if the parameter is set (for arrays, if any
* element is set).
@ -2765,6 +2766,8 @@ c_test(const char **wp)
for (argc = 0; wp[argc]; argc++)
;
mkssert(argc > 0);
mkssert(wp[0] != NULL);
if (strcmp(wp[0], "[") == 0) {
if (strcmp(wp[--argc], "]") != 0) {