aboutsummaryrefslogtreecommitdiffstats
path: root/main/utils.c
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-03-10 23:15:55 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-03-10 23:15:55 +0000
commit96c454daeaf83d078403a23ce00b55f175314816 (patch)
tree52d2f88e96f848e78adb604606904e2111df9f10 /main/utils.c
parente8da35fb87296575580b39ebe7e51eeb47dd913d (diff)
Add new unit test for stringfields.
(Copied from reviewboard) Tests the following: 1. Basic allocation and setting of string fields. 2. Shrinking a string field and re-expanding it. 3. Growing the last allocation in a string field pool. 4. Setting a string to a large value such that a new string field pool must be allocated. In each part, we make sure that the string field is accurate (has the correct value in it), make sure that the 2 bytes before the string field has the correct capacity for the field, and for tests 2-4, we make sure that the string field is where we expect it to be in memory. Also tested: 5. Shrinking a string field and partially re-expanding it. 6. Setting strings in such a way as to create three separate string field pools and then removing the middle pool. There is a bug fix in the init function, which ensures the embedded_pool is set to NULL which is important for stack allocated structures. Review: https://reviewboard.asterisk.org/r/185/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@251736 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/utils.c')
-rw-r--r--main/utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/main/utils.c b/main/utils.c
index fcf3a4f75..bd14f99ad 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -1561,6 +1561,7 @@ int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_
#endif
if (needed > 0) { /* allocate the initial pool */
*pool_head = NULL;
+ mgr->embedded_pool = NULL;
return add_string_pool(mgr, pool_head, needed, file, lineno, func);
}