Add some assertions – mkssert() – for things clang’s scan-build can’t see
This commit is contained in:
parent
9ed7b897a9
commit
566f882d83
5
sh.h
5
sh.h
@ -150,7 +150,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.377 2010/01/28 15:13:25 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.378 2010/01/28 20:26:51 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R39 2010/01/08"
|
||||
|
||||
@ -1624,7 +1624,8 @@ char *str_val(struct tbl *);
|
||||
int setstr(struct tbl *, const char *, int);
|
||||
struct tbl *setint_v(struct tbl *, struct tbl *, bool);
|
||||
void setint(struct tbl *, mksh_ari_t);
|
||||
struct tbl *typeset(const char *, Tflag, Tflag, int, int);
|
||||
struct tbl *typeset(const char *, Tflag, Tflag, int, int)
|
||||
MKSH_A_NONNULL((nonnull (1)));
|
||||
void unset(struct tbl *, int);
|
||||
const char *skip_varname(const char *, int);
|
||||
const char *skip_wdvarname(const char *, int);
|
||||
|
4
var.c
4
var.c
@ -22,7 +22,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.103 2010/01/25 14:38:04 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.104 2010/01/28 20:26:52 tg Exp $");
|
||||
|
||||
/*
|
||||
* Variables
|
||||
@ -680,6 +680,8 @@ typeset(const char *var, Tflag set, Tflag clr, int field, int base)
|
||||
val = skip_varname(var, false);
|
||||
if (val == var)
|
||||
return (NULL);
|
||||
mkssert(var != NULL);
|
||||
mkssert(*var != 0);
|
||||
if (*val == '[') {
|
||||
if (set_refflag)
|
||||
errorf("%s: reference variable cannot be an array",
|
||||
|
Loading…
Reference in New Issue
Block a user