]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
ast_value_set_name to return bool
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 27 Apr 2012 11:32:52 +0000 (13:32 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 27 Apr 2012 11:32:52 +0000 (13:32 +0200)
ast.c
ast.h

diff --git a/ast.c b/ast.c
index f42a2fa74807e0fddc8cefd528be99889895684b..35e72eb6dfea051c4540ba7f03dfc1a936d499e9 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -102,11 +102,12 @@ void ast_value_delete(ast_value* self)
     mem_d(self);
 }
 
-void ast_value_set_name(ast_value *self, const char *name)
+bool ast_value_set_name(ast_value *self, const char *name)
 {
     if (self->name)
         mem_d((void*)self->name);
     self->name = util_strdup(name);
+    return !!self->name;
 }
 
 ast_binary* ast_binary_new(lex_ctx_t ctx, int op,
diff --git a/ast.h b/ast.h
index ec46c9f8b710ab6c20044f273d31a6f0de147e8b..00922d603853a730130204cb8fefac31d82d00ec 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -111,7 +111,7 @@ struct ast_value_s
 ast_value* ast_value_new(lex_ctx_t ctx, const char *name, int qctype, bool keep);
 void ast_value_delete(ast_value*);
 
-void ast_value_set_name(ast_value*, const char *name);
+bool ast_value_set_name(ast_value*, const char *name);
 
 bool ast_value_codegen(ast_value*, ast_function*, ir_value**);