aboutsummaryrefslogtreecommitdiffstats
path: root/main/strings.c
AgeCommit message (Collapse)AuthorFilesLines
2010-02-17Fix two problems in ast_str functions found while writing a unit test.mmichelson1-4/+4
1. The documentation for ast_str_set and ast_str_append state that the max_len parameter may be -1 in order to limit the size of the ast_str to its current allocated size. The problem was that the max_len parameter in all cases was a size_t, which is unsigned. Thus a -1 was interpreted as UINT_MAX instead of -1. Changing the max_len parameter to be ssize_t fixed this issue. 2. Once issue 1 was fixed, there was an off-by-one error in the case where we attempted to write a string larger than the current allotted size to a string when -1 was passed as the max_len parameter. When trying to write more than the allotted size, the ast_str's __AST_STR_USED was set to 1 higher than it should have been. Thanks to Tilghman for quickly spotting the offending line of code. Oh, and the unit test that I referenced in the top line of this commit will be added to reviewboard shortly. Sit tight... git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247335 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-16Add va_end calls to __ast_str_helper.mmichelson1-0/+2
According to the man page for stdarg(3), "Each invocation of va_copy() must be matched by a corresponding invocation of va_end() in the same function." There were several cases in __ast_str_helper where va_copy was not matched with a corresponding call to va_end. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247076 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-16Change the blanket rules to delete .lastclean on all CFLAGS menuselect ↵tilghman1-2/+2
targets to be more particular. This change builds upon the recent change to menuselect to add 'touch_on_change' as an attribute of both categories and members. This should allow only the most invasive defines to cause a complete rebuild, while defines which only affect a subset of modules will only cause a rebuild of that smaller set. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@246789 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-29Merge str_substitution branch.tilghman1-11/+0
This branch adds additional methods to dialplan functions, whereby the result buffers are now dynamic buffers, which can be expanded to the size of any result. No longer are variable substitutions limited to 4095 bytes of data. In addition, the common case of needing buffers much smaller than that will enable substitution to only take up the amount of memory actually needed. The existing variable substitution routines are still available, but users of those API calls should transition to using the dynamic-buffer APIs. Reviewboard: http://reviewboard.digium.com/r/174/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@191140 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-02Missed a common case for needing to extend the buffer.tilghman1-1/+2
(closes issue #14716) Reported by: sum Patches: 20090402__bug14716.diff.txt uploaded by tilghman (license 14) Tested by: sum git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186021 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-01Merge changes from str_substitution that are unrelated to that branch.tilghman1-3/+2
Included is a small bugfix to an ast_str helper, but most of these changes are simply doxygen fixes. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@185912 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-11Add MALLOC_DEBUG to various utility APIs, so that memory leaks can be ↵tilghman1-1/+12
tracked back to their source. (related to issue #14636) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181028 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-18Handle negative length and eliminate a condition that is always true.tilghman1-6/+5
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@177287 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-16Might want to update the buffer pointer after a realloc (or we crash)tilghman1-0/+6
(closes issue #14485) Reported by: davevg git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176360 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-18Remove duplicate code from the ast_str API. We now use __AST_STR_* toeliel1-89/+20
access 'struct ast_str' members, but this must only be used inside the API implementation. (closes issue #14098) Reported by: eliel Patches: ast_str.patch uploaded by eliel (license 64) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@165502 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-13Merge ast_str_opaque branch (discontinue usage of ast_str internals)tilghman1-0/+219
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@163991 f38db490-d61c-443f-a65b-d21fe96a405b