diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-03 01:15:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-04 16:29:02 +0300 |
commit | 1246fcc42bc44f624a1c8bd855fd1dd82d51f228 (patch) | |
tree | 5ad659704c2f57711dc77e184e4110b527e12e79 /src/emap/craftconf.c | |
parent | 9b47893aa8736d173ca85a30c5336d9418b3044f (diff) | |
download | plugin-1246fcc42bc44f624a1c8bd855fd1dd82d51f228.tar.gz plugin-1246fcc42bc44f624a1c8bd855fd1dd82d51f228.tar.bz2 plugin-1246fcc42bc44f624a1c8bd855fd1dd82d51f228.tar.xz plugin-1246fcc42bc44f624a1c8bd855fd1dd82d51f228.zip |
Reduce memory usage in vectors.evolrelease2016-08-07
Diffstat (limited to 'src/emap/craftconf.c')
-rw-r--r-- | src/emap/craftconf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/emap/craftconf.c b/src/emap/craftconf.c index 0c9d329..7056d4f 100644 --- a/src/emap/craftconf.c +++ b/src/emap/craftconf.c @@ -100,7 +100,7 @@ static void craft_read_source_inventory(struct craft_db_entry *entry, struct config_setting_t *item; int invLen = VECTOR_LENGTH(entry->inventories); - VECTOR_ENSURE(entry->inventories, invLen + 1, 1); + VECTOR_ENSURE(entry->inventories, 1, 1); VECTOR_INSERTZEROED(entry->inventories, invLen); struct craft_db_inventory *inventory = &VECTOR_INDEX(entry->inventories, invLen); @@ -145,7 +145,7 @@ static void craft_read_create_items(struct craft_db_entry *entry, struct config_setting_t *item; int invLen = VECTOR_LENGTH(entry->create_items); - VECTOR_ENSURE(entry->create_items, invLen + 1, 1); + VECTOR_ENSURE(entry->create_items, 1, 1); VECTOR_INSERTZEROED(entry->create_items, invLen); struct craft_items_collection *collection = &VECTOR_INDEX(entry->create_items, invLen); VECTOR_INIT(*collection); @@ -171,7 +171,7 @@ static void craft_read_create_items(struct craft_db_entry *entry, continue; } - VECTOR_ENSURE(*collection, collecitonLen + 1, 1); + VECTOR_ENSURE(*collection, 1, 1); VECTOR_INSERTZEROED(*collection, collecitonLen); struct item_pair *pair = &VECTOR_INDEX(*collection, collecitonLen); pair->index = itemId; @@ -282,7 +282,7 @@ static void craft_read_items_collection(struct craft_db_entry *entry, continue; } - VECTOR_ENSURE(*vector, len + 1, 1); + VECTOR_ENSURE(*vector, 1, 1); VECTOR_INSERTZEROED(*vector, len); struct item_pair *pair = &VECTOR_INDEX(*vector, len); len ++; |