Skip to content

Commit f5965ce

Browse files
committed
s/allocated/allocated_size
1 parent e7e9fe7 commit f5965ce

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

php_bson.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ typedef enum {
4949
typedef struct {
5050
char** elements;
5151
php_phongo_bson_field_path_item_types* element_types;
52-
size_t allocated;
52+
size_t allocated_size;
5353
size_t size;
5454
size_t ref_count;
5555
bool free_elements;
@@ -70,7 +70,7 @@ typedef struct {
7070
zend_class_entry* root;
7171
struct {
7272
php_phongo_field_path_map_element** map;
73-
size_t allocated;
73+
size_t allocated_size;
7474
size_t size;
7575
} field_paths;
7676
} php_phongo_bson_typemap;

src/BSON/functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ PHP_FUNCTION(MongoDB_BSON_toPHP)
7777
php_phongo_bson_typemap_dtor(&state.map);
7878
RETURN_NULL();
7979
}
80-
80+
8181
php_phongo_bson_typemap_dtor(&state.map);
8282

8383
#if PHP_VERSION_ID >= 70000

src/bson.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ void php_phongo_field_path_free(php_phongo_field_path* field_path)
117117

118118
static void php_phongo_field_path_ensure_allocation(php_phongo_field_path* field_path, size_t level)
119119
{
120-
if (level >= field_path->allocated) {
120+
if (level >= field_path->allocated_size) {
121121
size_t i;
122122

123-
field_path->allocated = field_path->size + PHONGO_FIELD_PATH_EXPANSION;
124-
field_path->elements = erealloc(field_path->elements, sizeof(char**) * field_path->allocated);
125-
field_path->element_types = erealloc(field_path->element_types, sizeof(php_phongo_bson_field_path_item_types*) * field_path->allocated);
123+
field_path->allocated_size = field_path->size + PHONGO_FIELD_PATH_EXPANSION;
124+
field_path->elements = erealloc(field_path->elements, sizeof(char**) * field_path->allocated_size);
125+
field_path->element_types = erealloc(field_path->element_types, sizeof(php_phongo_bson_field_path_item_types*) * field_path->allocated_size);
126126

127-
for (i = level; i < field_path->allocated; i++) {
127+
for (i = level; i < field_path->allocated_size; i++) {
128128
field_path->elements[i] = NULL;
129129
field_path->element_types[i] = PHONGO_FIELD_PATH_ITEM_NONE;
130130
}
@@ -1298,9 +1298,9 @@ static void field_path_map_element_set_info(php_phongo_field_path_map_element* e
12981298
static void map_add_field_path_element(php_phongo_bson_typemap* map, php_phongo_field_path_map_element* element)
12991299
{
13001300
/* Make sure we have allocated enough */
1301-
if (map->field_paths.allocated < map->field_paths.size + 1) {
1302-
map->field_paths.allocated += PHONGO_FIELD_PATH_EXPANSION;
1303-
map->field_paths.map = erealloc(map->field_paths.map, sizeof(php_phongo_field_path_map_element) * map->field_paths.allocated);
1301+
if (map->field_paths.allocated_size < map->field_paths.size + 1) {
1302+
map->field_paths.allocated_size += PHONGO_FIELD_PATH_EXPANSION;
1303+
map->field_paths.map = erealloc(map->field_paths.map, sizeof(php_phongo_field_path_map_element) * map->field_paths.allocated_size);
13041304
}
13051305

13061306
map->field_paths.map[map->field_paths.size] = element;

0 commit comments

Comments
 (0)