flush
[m6w6/ext-psi] / src / parser.h
index ff0d4d6f1d1596d48c14c7a5a9622ce42291008a..fe3ff8e8759b9aacbd7f21ce1b5b307438abfa13 100644 (file)
@@ -405,12 +405,14 @@ static inline void free_impl_func(impl_func *f) {
 typedef struct let_func {
        token_t type;
        char *name;
+       size_t size;
 } let_func;
 
-static inline let_func *init_let_func(token_t type, char *name) {
+static inline let_func *init_let_func(token_t type, char *name, size_t size) {
        let_func *func = malloc(sizeof(*func));
        func->type = type;
-       func->name = (char *) strdup((const char *) name);
+       func->name = strdup(name);
+       func->size = size;
        return func;
 }
 
@@ -461,7 +463,9 @@ static inline let_stmt *init_let_stmt(decl_var *var, let_value *val) {
 
 static inline void free_let_stmt(let_stmt *stmt) {
        free_decl_var(stmt->var);
-       free_let_value(stmt->val);
+       if (stmt->val) {
+               free_let_value(stmt->val);
+       }
        free(stmt);
 }