Print this page
11972 resync smatch
@@ -67,10 +67,28 @@
if (type != &char_ctype)
return;
set_terminated(array, &terminated);
}
+static struct smatch_state *get_terminated_state_var_sym(const char *name, struct symbol *sym)
+{
+ struct sm_state *sm, *tmp;
+
+ sm = get_sm_state(my_id, name, sym);
+ if (!sm)
+ return NULL;
+ if (sm->state == &terminated || sm->state == &unterminated)
+ return sm->state;
+
+ FOR_EACH_PTR(sm->possible, tmp) {
+ if (tmp->state == &unterminated)
+ return &unterminated;
+ } END_FOR_EACH_PTR(tmp);
+
+ return NULL;
+}
+
static struct smatch_state *get_terminated_state(struct expression *expr)
{
struct sm_state *sm, *tmp;
if (!expr)
@@ -238,10 +256,17 @@
set_terminated_var_sym(name, sym, (*value == '1') ? &terminated : &unterminated);
free:
free_string(name);
}
+bool is_nul_terminated_var_sym(const char *name, struct symbol *sym)
+{
+ if (get_terminated_state_var_sym(name, sym) == &terminated)
+ return 1;
+ return 0;
+}
+
bool is_nul_terminated(struct expression *expr)
{
if (get_terminated_state(expr) == &terminated)
return 1;
return 0;