diff --git a/src/bindings.c b/src/bindings.c index aae564478..fad958cd4 100755 --- a/src/bindings.c +++ b/src/bindings.c @@ -83,7 +83,7 @@ without prior permission by the authors of Eressea. #include #include -#define TOLUA_PKG(NAME) extern void tolua_##NAME##_open(lua_State * L) +#define TOLUA_PKG(NAME) void tolua_##NAME##_open(lua_State * L) TOLUA_PKG(eressea); TOLUA_PKG(process); @@ -328,7 +328,7 @@ static int tolua_addequipment(lua_State * L) if (iname != NULL) { const struct item_type *itype = it_find(iname); if (itype != NULL) { - equipment_setitem(create_equipment(eqname), itype, value); + equipment_setitem(get_or_create_equipment(eqname), itype, value); result = 0; } } @@ -461,7 +461,7 @@ static int tolua_equipment_setitem(lua_State * L) if (iname != NULL) { const struct item_type *itype = it_find(iname); if (itype != NULL) { - equipment_setitem(create_equipment(eqname), itype, value); + equipment_setitem(get_or_create_equipment(eqname), itype, value); result = 0; } } diff --git a/src/kernel/equipment.c b/src/kernel/equipment.c index 1587e7531..7874a2c32 100644 --- a/src/kernel/equipment.c +++ b/src/kernel/equipment.c @@ -39,7 +39,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. static equipment *equipment_sets; -equipment *create_equipment(const char *eqname) +equipment *get_or_create_equipment(const char *eqname) { equipment **eqp = &equipment_sets; for (;;) { diff --git a/src/kernel/equipment.h b/src/kernel/equipment.h index 5c7b3407b..84fe55722 100644 --- a/src/kernel/equipment.h +++ b/src/kernel/equipment.h @@ -56,7 +56,7 @@ extern "C" { void equipment_done(void); - struct equipment *create_equipment(const char *eqname); + struct equipment *get_or_create_equipment(const char *eqname); struct equipment *get_equipment(const char *eqname); void equipment_setitem(struct equipment *eq, diff --git a/src/kernel/equipment.test.c b/src/kernel/equipment.test.c index 2911af1ea..ad69bec10 100644 --- a/src/kernel/equipment.test.c +++ b/src/kernel/equipment.test.c @@ -29,7 +29,7 @@ void test_equipment(CuTest * tc) CuAssertPtrNotNull(tc, sp); CuAssertPtrEquals(tc, 0, get_equipment("herpderp")); - eq = create_equipment("herpderp"); + eq = get_or_create_equipment("herpderp"); CuAssertPtrEquals(tc, eq, get_equipment("herpderp")); equipment_setitem(eq, it_horses, "1"); diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index 2ba9d785a..cba01bc7b 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -1266,7 +1266,7 @@ add_subsets(xmlDocPtr doc, equipment * eq, xmlNodeSetPtr nsetSubsets) assert(propValue != NULL); eq->subsets[i].sets[set].chance = chance; eq->subsets[i].sets[set].set = - create_equipment((const char *)propValue); + get_or_create_equipment((const char *)propValue); xmlFree(propValue); } } @@ -1296,7 +1296,7 @@ static int parse_equipment(xmlDocPtr doc) xmlChar *propName = xmlGetProp(node, BAD_CAST "name"); if (propName != NULL) { - equipment *eq = create_equipment((const char *)propName); + equipment *eq = get_or_create_equipment((const char *)propName); xmlXPathObjectPtr xpathResult; xpath->node = node;