self->context.file = "<@no context>";
self->context.line = 0;
self->name = NULL;
- ir_value_set_name(self, name);
+ if (name && !ir_value_set_name(self, name)) {
+ irerror(self->context, "out of memory");
+ mem_d(self);
+ return NULL;
+ }
memset(&self->constval, 0, sizeof(self->constval));
memset(&self->code, 0, sizeof(self->code));
mem_d(self);
}
-void ir_value_set_name(ir_value *self, const char *name)
+bool ir_value_set_name(ir_value *self, const char *name)
{
if (self->name)
mem_d((void*)self->name);
self->name = util_strdup(name);
+ return !!self->name;
}
bool ir_value_set_float(ir_value *self, float f)
*/
ir_value* ir_value_out(struct ir_function_s *owner, const char *name, int st, int vtype);
void ir_value_delete(ir_value*);
-void ir_value_set_name(ir_value*, const char *name);
+bool ir_value_set_name(ir_value*, const char *name);
ir_value* ir_value_vector_member(ir_value*, unsigned int member);
MEM_VECTOR_PROTO_ALL(ir_value, struct ir_instr_s*, reads);