From 8691368a81a3a5fa4f22ea42a9ba99f18ccfb061 Mon Sep 17 00:00:00 2001 From: rlar Date: Fri, 25 Mar 2016 15:38:31 +0100 Subject: [PATCH] struct variable, #11/18, introduce `var_alloc()' --- src/frontend/variable.c | 10 ++++++++++ src/frontend/variable.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/frontend/variable.c b/src/frontend/variable.c index 7735b5027..8c1c1a602 100644 --- a/src/frontend/variable.c +++ b/src/frontend/variable.c @@ -973,6 +973,16 @@ cp_vprint(void) tfree(vars); } +struct variable * +var_alloc(char *name, struct variable *next) +{ + struct variable *v = TMALLOC(struct variable, 1); + ZERO(v, struct variable); + v -> va_name = name; + v -> va_next = next; + return v; +} + void var_set_bool(struct variable *v, bool value) { diff --git a/src/frontend/variable.h b/src/frontend/variable.h index 00877b7e8..f7c15dcce 100644 --- a/src/frontend/variable.h +++ b/src/frontend/variable.h @@ -43,6 +43,8 @@ wordlist *cp_varwl(struct variable *var); wordlist *cp_variablesubst(wordlist *wlist); void free_struct_variable(struct variable *v); +struct variable *var_alloc(char *name, struct variable *next); + void var_set_bool(struct variable *, bool); void var_set_num(struct variable *, int); void var_set_real(struct variable *, double);