mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
revert an optimization that broke ABI... thanks russell!
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@133237 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
26
main/utils.c
26
main/utils.c
@@ -1223,7 +1223,6 @@ static int add_string_pool(struct ast_string_field_mgr *mgr, size_t size)
|
||||
mgr->size = size;
|
||||
mgr->space = size;
|
||||
mgr->used = 0;
|
||||
mgr->last_alloc = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1260,33 +1259,9 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr
|
||||
result = mgr->pool->base + mgr->used;
|
||||
mgr->used += needed;
|
||||
mgr->space -= needed;
|
||||
mgr->last_alloc = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
int __ast_string_field_index_grow(struct ast_string_field_mgr *mgr, size_t needed,
|
||||
ast_string_field *fields, int index)
|
||||
{
|
||||
int grow = needed - (strlen(fields[index]) + 1);
|
||||
|
||||
if (grow <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fields[index] != mgr->last_alloc) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mgr->space < grow) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
mgr->space -= grow;
|
||||
mgr->used += grow;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __ast_string_field_index_build_va(struct ast_string_field_mgr *mgr,
|
||||
ast_string_field *fields, int num_fields,
|
||||
int index, const char *format, va_list ap1, va_list ap2)
|
||||
@@ -1310,7 +1285,6 @@ void __ast_string_field_index_build_va(struct ast_string_field_mgr *mgr,
|
||||
}
|
||||
|
||||
fields[index] = mgr->pool->base + mgr->used;
|
||||
mgr->last_alloc = fields[index];
|
||||
mgr->used += needed;
|
||||
mgr->space -= needed;
|
||||
}
|
||||
|
Reference in New Issue
Block a user