FxB_Node *FxB_Node_create(void *value) { FxB_Node *node = fx_alloc(FxB_Node); verify_memory(node); fxb_node_value(node) = value; return node; error: return NULL; }
string fx_strcatn(int n, ...) { va_list va; va_start(va, n); string* array = fx_alloc(n, string); for (int i = 0; i < n; i++) array[i] = va_arg(va, string); string result = fx_strjoin(NULL, array, n); free(array); va_end(va); return result; }
FxI_Object *FxI_Object_create(FxI_Interpreter *interpreter, FxI_Object *klass) { FxI_Object *object = fx_alloc(FxI_Object); verify_memory(object); FxB_HashMap *attributes = FxB_HashMap_create(FXN_OBJECT_ATTRIBUTE_HASHMAP_SIZE); verify(attributes); fxi_object_class(object) = klass; fxi_object_attributes(object) = attributes; return object; error: if (object) { fx_pfree(object); } return NULL; }
FxI_MethodGroup *FxI_MethodGroup_create(char *method_name) { FxI_MethodGroup *method_group = fx_alloc(FxI_MethodGroup); verify_memory(method_group); fxi_method_group_name(method_group) = method_name; FxB_List *functions = FxB_List_create(); verify(functions); fxi_method_group_functions(method_group) = functions; return method_group; error: if (method_group) { fx_pfree(method_group); } return NULL; }