summaryrefslogtreecommitdiff
path: root/include/asterisk/strings.h
AgeCommit message (Collapse)Author
2008-07-02Fix a bunch of places where \arg was used instead of \param. Using \argRussell Bryant
to document arguments seems logical, and does work, but is not the best thing to use. \arg in doxygen is simply for creating non-nested unordered lists. \param is the correct tag to use to document function parameters, and will come out better in the generated documentation. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127401 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-15Add an extra check in ast_strlen_zero, and make ast_assert() not print theTilghman Lesher
file, line, and function name twice. (Closes issue #12650) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-28Temporary revert of 111662. It's causing lots of trouble and appears to not beMark Michelson
the proper solution to the problem reported anyway. (related to issue #12884) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111777 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-28The copy_request function did not take into account the necessary null ↵Mark Michelson
terminator for the string to be copied into. This resulted in parse_request reading invalid memory beyond the end of the string, and in some cases led to crashes. Thanks to falves11 for providing the valgrind output which led to the closure of this issue. (closes issue #12284) Reported by: falves11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111662 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-18Go through and fix a bunch of places where character strings were being ↵Terry Wilson
interpreted as format strings. Most of these changes are solely to make compiling with -Wsecurity and -Wformat=2 happy, and were not actual problems, per se. I also added format attributes to any printf wrapper functions I found that didn't have them. -Wsecurity and -Wmissing-format-attribute added to --enable-dev-mode. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109447 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-15Fix up some doxygen issues.Jason Parker
(closes issue #11996) Patches: bug_11996_doxygen.diff uploaded by snuffy (license 35) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103723 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-19Add a new API function, written at least twice in app_voicemail.cLuigi Rizzo
and likely in other places too. This is quite useful when placing mail/html stuff in config files. /*! \brief Convert some C escape sequences (\b\f\n\r\t) into the equivalent characters. \brief s The string to be converted (will be modified). \return The converted string. */ char *ast_unescape_c(char *s); git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-27Add an S_COR macro, which is similar to the existing S_OR macro,Jason Parker
except with an additional boolean arg. A hack such as: foo ? S_OR(bar, "baz") : "baz" becomes: S_COR(foo, bar, "baz") git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16remove redundant #include "asterisk/compat.h",Luigi Rizzo
but make sure that asterisk/compiler.h is included everywhere git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89336 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16Start untangling header inclusion in a way that does not affectLuigi Rizzo
build times - tested, there is no measureable difference before and after this commit. In this change: use asterisk/compat.h to include a small set of system headers: inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h, stdlib.h, alloca.h, stdio.h Where available, the inclusion is conditional on HAVE_FOO_H as determined by autoconf. Normally, source files should not include any of the above system headers, and instead use either "asterisk.h" or "asterisk/compat.h" which does it better. For the time being I have left alone second-level directories (main/db1-ast, etc.). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-15Merged revisions 85561 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r85561 | russell | 2007-10-15 11:34:13 -0500 (Mon, 15 Oct 2007) | 4 lines Make a few changes so that characters in the upper half of the ISO-8859-1 character set don't get stripped when reading configuration. (closes issue #10982, dandre) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85562 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-05Doxygen cleanups/fixes.Jason Parker
Closes issue #10654, patch by snuffy git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-22Merged revisions 80362 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r80362 | russell | 2007-08-22 15:21:36 -0500 (Wed, 22 Aug 2007) | 34 lines Merge changes from team/russell/iax_refcount. This set of changes fixes problems with the handling of iax2_user and iax2_peer objects. It was very possible for a thread to still hold a reference to one of these objects while a reload operation tries to delete them. The fix here is to ensure that all references to these objects are tracked so that they can't go away while still in use. To accomplish this, I used the astobj2 reference counted object model. This code has been in one of Luigi Rizzo's branches for a long time and was primarily developed by one of his students, Marta Carbone. I wanted to go ahead and bring this in to 1.4 because there are other problems similar to the ones fixed by these changes, so we might as well go ahead and use the new astobj if we're going to go through all of the work necessary to fix the problems. As a nice side benefit of these changes, peer and user handling got more efficient. Using astobj2 lets us not hold the container lock for peers or users nearly as long while iterating. Also, by changing a define at the top of chan_iax2.c, the objects will be distributed in a hash table, drastically increasing lookup speed in these containers, which will have a very big impact on systems that have a large number of users or peers. The use of the hash table will be made the default in trunk. It is not the default in 1.4 because it changes the behavior slightly. Previously, since peers and users were stored in memory in the same order they were specified in the configuration file, you could influence peer and user matching order based on the order they are specified in the configuration. The hash table does not guarantee any order in the container, so this behavior will be going away. It just means that you have to be a little more careful ensuring that peers and users are matched explicitly and not forcing chan_iax2 to have to guess which user is the right one based on secret, host, and access list settings, instead of simply using the username. If you have any questions, feel free to ask on the asterisk-dev list. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-17Merged revisions 79904 via svnmerge from Jason Parker
https://origsvn.digium.com/svn/asterisk/branches/1.4 (closes issue #10430) ........ r79904 | qwell | 2007-08-17 14:12:19 -0500 (Fri, 17 Aug 2007) | 11 lines Don't send a semicolon over the wire in sip notify messages. Caused by fix for issue 9938. I basically took the code that existed before 9938 was fixed, and copied it into a new function - ast_unescape_semicolon There should be very few places this will be needed (pbx_config does NOT need this (see issue 9938 for details)) Issue 10430, patch by me, with help/ideas from murf (thanks murf). ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-18Merge in ast_strftime branch, which changes timestamps to be accurate to the ↵Tilghman Lesher
microsecond, instead of only to the second git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-16Merge a bunch of doxygen updates to header files. This includes changes toRussell Bryant
use the \retval tag for documenting return values, fixing various warnings when generating the documentation, and various other things. (closes issue #10203, snuffy) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75164 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-28Remove the ill-advised ast_restrdupa API call and related structuresTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@72492 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-07Fix a bunch of doxygen errors and document more thingsRussell Bryant
(issue #9842, snuffy) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@68339 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-19As the comment in the diff says:Luigi Rizzo
AST_INLINE_API() is a macro that takes a block of code as an argument. Using preprocessor #directives in the argument is not supported by all compilers, and it is a bit of an obfuscation anyways, so avoid it. As a workaround, define a macro that produces either its argument or nothing, and use that instead of #ifdef/#endif within the argument to AST_INLINE_API(). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51312 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-10Return the useless casts that ensure this file is C++ clean. (issue #8602 ↵Joshua Colp
reported by mikma) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@50397 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-04ensure that the proper file/function/line shows up for dynamic string ↵Kevin P. Fleming
threadstorage objects remove pointless casts git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-04Merged revisions 49553 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r49553 | kpfleming | 2007-01-04 16:51:01 -0600 (Thu, 04 Jan 2007) | 2 lines add support for tracking thread-local-storage objects that exist via 'threadstorage' CLI commands ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49578 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-18apply the proposed fix for bug 8602Luigi Rizzo
http://bugs.digium.com/view.php?id=8602 (i am not sure if there is still missing cast in front of the alloca() call - being a macro this is probably triggered only when actually used). Add function ast_str_reset() to reinitialize the string to an empty string instead of playing with the internal fields. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-16replace ast_build_string() with ast_str_*() functions.Luigi Rizzo
This makes the code easier to follow and saves some copies to intermediate buffers. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48515 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-15simplify the ast_dynamic_str_*.... routines byLuigi Rizzo
renaming them to ast_str ... and putting the struct ast_threadstorage pointer into the struct ast_str. This makes the code a lot more readable. At this point we can use these routines also to replace ast_build_string(). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48510 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-15move the dynamic string support in a better place i.e. string.hLuigi Rizzo
While doing this, add a bit of documentation, and slightly extend the functionality as follows: + a max_len of -1 means that we take whatever the current size is, and never try to extend the buffer; + add support for alloca()-ted dynamic strings, which is very useful for all cases where we do an ast_build_string() now. Next step is to simplify the interface by using shorter names (e.g. ast_str as a prefix) and removing the _thread variant of the functions by saving the threadstorage reference into the struct ast_str. This can be done by overloading the 'type' field. Finally, I will do my best to remove the convoluted interface that results from trying to support platforms without va_copy(). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-15Many Solaris fixes - this moves some of the stuff from utils.c to strcompat.cJason Parker
Every OS uses strcompat now - this was done on purpose. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@42982 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-07-10Fixed. Done. Good. Make ast_join work like it used to.Joshua Colp
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37348 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-07-10Unbreak ast_join due to whitespace changesJoshua Colp
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37347 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-26add the missing prototype for the included asprintfRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@22526 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-03-24as discussed on the -dev list, introduce a macro to simplify theLuigi Rizzo
writing of common constructs like chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>"; (or the if/then/else form) into chan = S_OR(cdr->channel, "<unknown>"); The name can be changed if we find a better (and not too long) one; currently, it is S as String, OR as it mimics the behaviour of the || operator, but applied to strings. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@14747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-23add 'consumed' argument to ast_get_time_t, so callers can know how many ↵Kevin P. Fleming
characters were used in the parser update pbx_dundi to use ast_get_time_t eliminate some compiler warnings git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10871 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-15add API function for parsing strings to time_t (issue #6320, with mods)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-01-07Bug 6164 - Allow ast_skip_blanks on const strings without spewing warningTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7854 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-01-05Merged revisions 7827 via svnmerge fromTilghman Lesher
/branches/1.2 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-12-20- move the string join() function to utils.c since it is used in both cli.c ↵Russell Bryant
and res_agi.c - reimplement ast_join to be of linear effieciency instead of quadratic - remove some useless checks for "if (e)" - reorder checks for strings starting with '_' to avoid a useless call to ast_join() - check array bounds when parsing arguments to AGI (issue #5868) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7556 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-29remove extraneous svn:executable propertiesKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-01add new GCC-specific macro and force inlining of certain functions where ↵Kevin P. Fleming
speed is paramount, even when optimization is disabled git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6929 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-26clean up a lot of doxygen errors and warnings (issue #5522)Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6865 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-26change ast_strlen_zero to also check for the string to be definedRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6862 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-24Doxygen documentation update from oej (issue #5505)Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6847 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-01add ast_build_string_va(), which accepts a varargs list directlyKevin P. Fleming
ensure the _entire_ manager_event() output is either queued or sent via ast_carefulwrite() git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6708 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-09-14don't double define our own string functions on platforms that don't have ↵Kevin P. Fleming
them (issue #5169) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6587 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-09-08first set of Cygwin portability stuff (issue #4678)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6547 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-08-30major header file cleanup: license, copyrights, descriptions, markers, etc.Kevin P. Fleming
remove deprecated config_old.c/config_old.h remove unused cvsid.h git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-08-04ensure that strings.h has va_list defined (bug #4900)Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6280 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-20move strtoq into new string files (bug #4740)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6171 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-15phase two of string portability stuff:Kevin P. Fleming
don't need ast_ prefixes on functions use individual #defines for function presence add vasprintf to portability library git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6143 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-15first phase of proper fix for portable string function problems (bug #4669)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6133 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-12convert ast_copy_string to use AST_INLINE_API macro (bug #4682)Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6108 65c4cc65-6c06-0410-ace0-fbb531ad65f3