aboutsummaryrefslogtreecommitdiffstats
path: root/main/utils.c
AgeCommit message (Collapse)AuthorFilesLines
2011-05-26Use va_copy for stringfieldstwilson1-13/+11
The ast_string_field_build_va functions were written to take to separate va_lists to work around FreeBSD 4 not having va_copy defined. In the end, we don't support anything using gcc < 3 anyway because we use va_copy all over the place anyway. This patch just simplifies things by removing the second va_list function arguments in favor of va_copy. Review: https://reviewboard.asterisk.org/r/1233/ --This line, and those below, will be ignored-- M include/asterisk/stringfields.h M main/utils.c M main/channel.c git-svn-id: http://svn.digium.com/svn/asterisk/trunk@320946 f38db490-d61c-443f-a65b-d21fe96a405b
2011-05-05Merged revisions 316917-316919 via svnmerge from seanbright1-2/+2
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r316917 | seanbright | 2011-05-04 22:23:28 -0400 (Wed, 04 May 2011) | 5 lines Make sure that tcptls_session is properly initialized. (issue #18598) Reported by: ksn ........ r316918 | seanbright | 2011-05-04 22:25:20 -0400 (Wed, 04 May 2011) | 5 lines Look at the correct buffer for our digest info instead of an empty one. (issue #18598) Reported by: ksn ........ r316919 | seanbright | 2011-05-04 22:30:45 -0400 (Wed, 04 May 2011) | 10 lines Use the correct HTTP method when generating our digest, otherwise we always fail. When calculating the 'A2' portion of our digest for verification, we need the HTTP method that is currently in use. Unfortunately our mapping function was incorrect, resulting in invalid hashes being generated and, in turn, failures in authentication. (closes issue #18598) Reported by: ksn ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@316920 f38db490-d61c-443f-a65b-d21fe96a405b
2011-03-15Merged revisions 310781 via svnmerge from alecdavis1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r310781 | alecdavis | 2011-03-15 14:00:55 +1300 (Tue, 15 Mar 2011) | 10 lines core show locks: display ThreadID in hexadecimal Allow easier cross referencing of thread ID's with GDB backtraces (closes issue #18968) Reported by: alecdavis Patches: bug18968.diff.txt uploaded by alecdavis (license 585) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@310833 f38db490-d61c-443f-a65b-d21fe96a405b
2011-01-31Merged revisions 304950 via svnmerge from tilghman1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r304950 | tilghman | 2011-01-31 00:41:36 -0600 (Mon, 31 Jan 2011) | 18 lines Change mutex tracking so that it only consumes memory in the core mutex object when it's actually being used. This reduces the overall size of a mutex which was 3016 bytes before this back down to 216 bytes (this is on 64-bit Linux with a glibc-implemented mutex). The exactness of the numbers here may vary slightly based upon how mutexes are implemented on a platform, but the long and short of it is that prior to this commit, chan_iax2 held down 98MB of memory on a 64-bit system for nothing more than a table of 32767 locks. After this commit, the same table occupies a mere 7MB of memory. (closes issue #18194) Reported by: job Patches: 20110124__issue18194.diff.txt uploaded by tilghman (license 14) Tested by: tilghman Review: https://reviewboard.asterisk.org/r/1066 ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@304951 f38db490-d61c-443f-a65b-d21fe96a405b
2011-01-25Use unsigned char in comparison for UTF8 check to quiet a compiler warning.mnicholson1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@303638 f38db490-d61c-443f-a65b-d21fe96a405b
2011-01-24According to section 19.1.2 of RFC 3261:mnicholson1-23/+53
For each component, the set of valid BNF expansions defines exactly which characters may appear unescaped. All other characters MUST be escaped. This patch modifies ast_uri_encode() to encode strings in line with this recommendation. This patch also adds an ast_escape_quoted() function which escapes '"' and '\' characters in quoted strings in accordance with section 25.1 of RFC 3261. The ast_uri_encode() function has also been modified to take an ast_flags struct describing the set of rules it should use when escaping characters to allow for it to escape SIP URIs in addition to HTTP URIs and other types of URIs or variations of those two URI types in the future. The ast_uri_decode() function has also been modified to accept an ast_flags struct describing the set of rules to use when decoding to enable decoding '+' as ' ' in legacy http URLs. The unit tests for these functions have also been updated. ABE-2705 Review: https://reviewboard.asterisk.org/r/1081/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@303509 f38db490-d61c-443f-a65b-d21fe96a405b
2011-01-19Merged revisions 302555 via svnmerge from seanbright1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r302555 | seanbright | 2011-01-19 14:03:32 -0500 (Wed, 19 Jan 2011) | 14 lines Merged revisions 302554 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r302554 | seanbright | 2011-01-19 14:02:29 -0500 (Wed, 19 Jan 2011) | 7 lines Don't call strlen() when we only need to look at the next character or two. (closes issue #18042) Reported by: wdoekes Patches: astsvn-inefficient-ast-uri-decode.patch uploaded by wdoekes (license 717) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@302556 f38db490-d61c-443f-a65b-d21fe96a405b
2011-01-19Merged revisions 302505 via svnmerge from seanbright1-0/+2
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r302505 | seanbright | 2011-01-19 12:58:11 -0500 (Wed, 19 Jan 2011) | 14 lines Merged revisions 302504 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r302504 | seanbright | 2011-01-19 12:56:32 -0500 (Wed, 19 Jan 2011) | 7 lines Make sure that h_length is set when we short-circuit out of ast_gethostbyname. (closes issue #16135) Reported by: thedavidfactor Patches: utils.patch uploaded by thedavidfactor (license 903) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@302507 f38db490-d61c-443f-a65b-d21fe96a405b
2011-01-11Merged revisions 301308 via svnmerge from mnicholson1-11/+10
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r301308 | mnicholson | 2011-01-11 12:51:40 -0600 (Tue, 11 Jan 2011) | 18 lines Merged revisions 301307 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r301307 | mnicholson | 2011-01-11 12:42:05 -0600 (Tue, 11 Jan 2011) | 11 lines Merged revisions 301305 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r301305 | mnicholson | 2011-01-11 12:34:40 -0600 (Tue, 11 Jan 2011) | 4 lines Prevent buffer overflows in ast_uri_encode() ABE-2705 ........ ................ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@301309 f38db490-d61c-443f-a65b-d21fe96a405b
2010-12-18Merged revisions 298960 via svnmerge from tilghman1-1/+21
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r298960 | tilghman | 2010-12-17 17:52:04 -0600 (Fri, 17 Dec 2010) | 20 lines Merged revisions 298957 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r298957 | tilghman | 2010-12-17 17:30:55 -0600 (Fri, 17 Dec 2010) | 13 lines Merged revisions 298905 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r298905 | tilghman | 2010-12-17 15:40:56 -0600 (Fri, 17 Dec 2010) | 6 lines Let Asterisk find better backtrace information with libbfd. The menuselect option BETTER_BACKTRACES, if enabled, will use libbfd to search for better symbol information within both the Asterisk binary, as well as loaded modules, to assist when using inline backtraces to track down problems. Review: https://reviewboard.asterisk.org/r/1055/ ........ ................ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@298961 f38db490-d61c-443f-a65b-d21fe96a405b
2010-12-12Add support for several platforms to obtain the real thread ID.jpeeler1-0/+25
Already had the pthread ID which is not the same. The most obvious enhancement is in the "core show threads" output. As stated in the utils header, if the platform isn't supported -1 is reported (instead of the process ID previously). git-svn-id: http://svn.digium.com/svn/asterisk/trunk@298137 f38db490-d61c-443f-a65b-d21fe96a405b
2010-08-06Merged revisions 281085 via svnmerge from tilghman1-1/+15
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r281085 | tilghman | 2010-08-06 13:57:10 -0500 (Fri, 06 Aug 2010) | 8 lines Fix alignment of stringfields on the SPARC architecture (closes issue #17789) Reported by: Ian Mason Patches: 20100806__issue17789__2.diff.txt uploaded by tilghman (license 14) Tested by: Ian_Mason ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@281086 f38db490-d61c-443f-a65b-d21fe96a405b
2010-07-02Fix various typos reported by Lintiantzafrir1-1/+1
(Also fix the typos in the comments) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@273641 f38db490-d61c-443f-a65b-d21fe96a405b
2010-03-10Add new unit test for stringfields.jpeeler1-0/+1
(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
2010-01-26RFC compliant uri and display-name encode/decodedvossel1-21/+24
1. URI Encoding This patch changes ast_uri_encode()'s behavior when doreserved is enabled. Previously when doreserved was enabled only a small set of reserved characters were encoded. This set was comprised primarily of the reserved characters defined in RFC3261 section 25.1, but contained other characters as well. Rather than only escaping the reserved set, doreserved now escapes all characters not within the unreserved set as defined by RFC 3261 and RFC 2396. Also, the 'doreserved' variable has been renamed to 'do_special_char' in attempts to avoid confusion. When doreserve is not enabled, the previous logic of only encoding the characters <= 0X1F and > 0X7f remains, except for the '%' character, which must always be encoded as it signifies a HEX escaped character during the decode process. 2. URI Decoding: Break up URI before decode. In chan_sip.c ast_uri_decode is called on the entire URI instead of it's individual parts after it is parsed. This is not good as ast_uri_decode can introduce special characters back into the URI which can mess up parsing. This patch resolves this by not decoding a URI until parsing is completely done. There are many instances where we check to see if pedantic checking is enabled before we decode a URI. In these cases a new macro, SIP_PEDANTIC_DECODE, is used on the individual parsed segments of the URI rather than constantly putting if (pedantic) { decode() } checks everywhere in the code. In the areas where ast_uri_decode is not dependent upon pedantic checking this macro is not used, but decoding is still moved to each individual part of the URI. The only behavior that should change from this patch is the time at which decoding occurs. Since I had to look over every place URI parsing occurs to create this patch, I found several places where we use duplicate code for parsing. To consolidate the code, those areas have updated to use the parse_uri() function where possible. 3. SIP display-name decoding according to RFC3261 section 25. To properly decode the display-name portion of a FROM header, chan_sip's get_calleridname() function required a complete re-write. More information about this change can be found in the comments at the beginning of this function. 4. Unit Tests. Unit tests for ast_uri_encode, ast_uri_decode, and get_calleridname() have been written. This involved the addition of the test_utils.c file for testing the utils api. (closes issue #16299) Reported by: wdoekes Patches: astsvn-16299-get_calleridname.diff uploaded by wdoekes (license 717) get_calleridname_rewrite.diff uploaded by dvossel (license 671) Tested by: wdoekes, dvossel, Nick_Lewis Review: https://reviewboard.asterisk.org/r/469/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@243200 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-15Make sure to set owner_line, ownder_func, and owner_file in ↵mmichelson1-0/+5
ast_calloc_with_stringfields. Asterisk would crash on startup if MALLOC_DEBUG were set in menuselect. This is because the manager action UpdateConfig had to resize its string field allocation to set the description. When the resize occurred, ast_copy_string would crash because we were attempting to copy a string from a NULL pointer. Setting the strings initially makes the code much less crashy. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@240420 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-05Fix build of utility apps that include utils.c.russell1-0/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@237749 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-05Merged revisions 237697 via svnmerge from russell1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r237697 | russell | 2010-01-05 11:13:28 -0600 (Tue, 05 Jan 2010) | 7 lines Change a NOTICE log message to DEBUG where it belongs. (closes issue #16479) Reported by: alexrecarey (closes SWP-577) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@237699 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-07fixes incorrect logic in ast_uri_encodedvossel1-1/+1
issue #16299 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@233611 f38db490-d61c-443f-a65b-d21fe96a405b
2009-11-06Merged revisions 228378 via svnmerge from mnicholson1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r228378 | mnicholson | 2009-11-06 10:26:59 -0600 (Fri, 06 Nov 2009) | 8 lines Properly handle '=' while decoding base64 messages and null terminate strings returned from BASE64_DECODE. (closes issue #15271) Reported by: chappell Patches: base64_fix.patch uploaded by chappell (license 8) Tested by: kobaz ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@228620 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-04Merged revisions 216435 via svnmerge from mvanbaak1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r216435 | mvanbaak | 2009-09-04 15:56:10 +0200 (Fri, 04 Sep 2009) | 2 lines make asterisk compile under devmode with DEBUG_THREADS enabled on OpenBSD ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216506 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-10AST-2009-005tilghman1-3/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@211539 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-28Ensure that accidental calls to ast_string_field_free_memory() on embedded ↵kpfleming1-4/+10
stringfield pools are safe. It is possible for a stringfield manager structure (and pool) structure to be allocated as part of a larger structure allocation (using ast_calloc_with_strinfields()); when this is done, the stringfield pool cannot be separately freed, but users of the tructure may not be aware (and shouldn't have to be aware) of whether the pool was embedded. This patch modifies the behavior so that they can always call ast_string_field_free_memory() and the function will do the right thing for both embedded and non-embedded situations. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197775 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-28Fix a bug in stringfields where it did not actually free the pools of memory.file1-1/+5
(closes issue #15074) Reported by: pj git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197538 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-21Const-ify the world (or at least a good part of it)kpfleming1-4/+4
This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes: - CLI command handlers - CLI command handler arguments - AGI command handlers - AGI command handler arguments - Dialplan application handler arguments - Speech engine API function arguments In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing. Review: https://reviewboard.asterisk.org/r/251/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196072 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-05Add a more efficient way of allocating structures that use stringfieldskpfleming1-0/+49
This commit adds an API call that can be used to allocate a structure along with this stringfield storage in a single allocation. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@192362 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-05Correct some flaws in the memory accounting code for stringfields and ao2 ↵kpfleming1-1/+1
objects Under some conditions, the memory allocation for stringfields and ao2 objects would not have supplied valid file/function names for MALLOC_DEBUG tracking, so this commit corrects that. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@192357 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-05Ensure that string pools allocated to hold stringfields are properly ↵kpfleming1-18/+41
accounted in MALLOC_DEBUG mode This commit modifies the stringfield pool allocator to remember the 'owner' of the stringfield manager the pool is being allocated for, and ensures that pools allocated in the future when fields are populated are owned by that file/function. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@192279 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-23Support HTTP digest authentication for the http manager interface.tilghman1-0/+120
(closes issue #10961) Reported by: ys Patches: digest_auth_r148468_v5.diff uploaded by ys (license 281) SVN branch http://svn.digium.com/svn/asterisk/team/group/manager_http_auth Tested by: ys, twilson, tilghman Review: http://reviewboard.digium.com/r/223/ Reviewed by: tilghman,russellb,mmichelson git-svn-id: http://svn.digium.com/svn/asterisk/trunk@190349 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-31Optimizations to the stringfields APIkpfleming1-45/+108
This patch provides a number of optimizations to the stringfields API, focused around saving (not wasting) memory whenever possible. Thanks to Mark Michelson for inspiring this work and coming up with the first two optimizations that are represented here: Changes: - Cleanup of some code, fix incorrect doxygen comments - When a field is emptied or replaced with a new allocation, decrease the amount of 'active' space in the pool it was held in; if that pool reaches zero active space, and is not the current pool, then free it as it is no longer in use - When allocating a pool, try to allocate a size that will fit in a 'standard' malloc() allocation without wasting space - When allocating space for a field, store the amount of space in the two bytes immediately preceding the field; this eliminates the need to call strlen() on the field when overwriting it, and more importantly it 'remembers' the amount of space the field has available, even if a shorter string has been stored in it since it was allocated - Don't automatically double the size of each successive pool allocated; it's wasteful http://reviewboard.digium.com/r/165/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@185581 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-18Merged revisions 182810 via svnmerge from russell1-2/+2
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r182810 | russell | 2009-03-17 21:09:13 -0500 (Tue, 17 Mar 2009) | 44 lines Fix cases where the internal poll() was not being used when it needed to be. We have seen a number of problems caused by poll() not working properly on Mac OSX. If you search around, you'll find a number of references to using select() instead of poll() to work around these issues. In Asterisk, we've had poll.c which implements poll() using select() internally. However, we were still getting reports of problems. vadim investigated a bit and realized that at least on his system, even though we were compiling in poll.o, the system poll() was still being used. So, the primary purpose of this patch is to ensure that we're using the internal poll() when we want it to be used. The changes are: 1) Remove logic for when internal poll should be used from the Makefile. Instead, put it in the configure script. The logic in the configure script is the same as it was in the Makefile. Ideally, we would have a functionality test for the problem, but that's not actually possible, since we would have to be able to run an application on the _target_ system to test poll() behavior. 2) Always include poll.o in the build, but it will be empty if AST_POLL_COMPAT is not defined. 3) Change uses of poll() throughout the source tree to ast_poll(). I feel that it is good practice to give the API call a new name when we are changing its behavior and not using the system version directly in all cases. So, normally, ast_poll() is just redefined to poll(). On systems where AST_POLL_COMPAT is defined, ast_poll() is redefined to ast_internal_poll(). 4) Change poll() in main/poll.c to be ast_internal_poll(). It's worth noting that any code that still uses poll() directly will work fine (if they worked fine before). So, for example, out of tree modules that are using poll() will not stop working or anything. However, for modules to work properly on Mac OSX, ast_poll() needs to be used. (closes issue #13404) Reported by: agalbraith Tested by: russell, vadim http://reviewboard.digium.com/r/198/ ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@182847 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-18Fixed error where a check for an zero length, terminated string was needed.dbailey1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@177035 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-18Need to take into account the \0 terminator of the old string to determine ↵dbailey1-1/+1
the amount available. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176948 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-16Merged revisions 176216 via svnmerge from kpfleming1-18/+38
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r176216 | kpfleming | 2009-02-16 15:10:38 -0600 (Mon, 16 Feb 2009) | 3 lines fix a flaw in the ast_string_field_build() family of API calls; these functions made no attempt to reuse the space already allocated to a field, so every time the field was written it would allocate new space, leading to what appeared to be a memory leak. ........ r176254 | kpfleming | 2009-02-16 15:41:46 -0600 (Mon, 16 Feb 2009) | 3 lines correct a logic error in the last stringfields commit... don't mark additional space as allocated if the string was built using already-allocated space ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176255 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-22Merged revisions 166297 via svnmerge from russell1-12/+25
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r166297 | russell | 2008-12-22 11:22:56 -0600 (Mon, 22 Dec 2008) | 2 lines Fix up timeout handling in ast_carefulwrite(). ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@166317 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-22Introduce ast_careful_fwrite() and use in AMI to prevent partial writes.russell1-24/+90
This patch introduces a function to do careful writes on a file stream which will handle timeouts and partial writes. It is currently used in AMI to address the issue that has been reported. However, there are probably a few other places where this could be used. (closes issue #13546) Reported by: srt Tested by: russell http://reviewboard.digium.com/r/104/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@166282 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-18Merged revisions 165796 via svnmerge from russell1-13/+38
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r165796 | russell | 2008-12-18 15:39:25 -0600 (Thu, 18 Dec 2008) | 11 lines Make ast_carefulwrite() be more careful. This patch handles some additional cases that could result in partial writes to the file description. This was done to address complaints about partial writes on AMI. (issue #13546) (more changes needed to address potential problems in 1.6) Reported by: srt Tested by: russell Review: http://reviewboard.digium.com/r/99/ ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@165801 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-16Merged revisions 164881 via svnmerge from russell1-0/+6
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r164881 | russell | 2008-12-16 15:38:29 -0600 (Tue, 16 Dec 2008) | 9 lines Fix an issue where DEBUG_THREADS may erroneously report that a thread is exiting while holding a lock. If the last lock attempt was a trylock, and it failed, it will still be in the list of locks so that it can be reported. (closes issue #13219) Reported by: pj ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@164882 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-15Update to work with new ast_str changes.file1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@164208 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-13Merge ast_str_opaque branch (discontinue usage of ast_str internals)tilghman1-60/+0
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@163991 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-09Merged revisions 162413 via svnmerge from russell1-62/+0
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r162413 | russell | 2008-12-09 16:17:39 -0600 (Tue, 09 Dec 2008) | 8 lines Remove the test_for_thread_safety() function completely. The test is not valid. Besides, if we actually suspected that recursive mutexes were not working, we would get a ton of LOG_ERROR messages when DEBUG_THREADS is turned on. (inspired by a discussion on the asterisk-dev list) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@162414 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-29incorporates r159808 from branches/1.4:kpfleming1-3/+0
------------------------------------------------------------------------ r159808 | kpfleming | 2008-11-29 10:58:29 -0600 (Sat, 29 Nov 2008) | 7 lines update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them format attributes in a consistent way ------------------------------------------------------------------------ in addition: move some format attributes from main/utils.c to the header files they belong in, and fix up references to the relevant functions based on new compiler warnings git-svn-id: http://svn.digium.com/svn/asterisk/trunk@159818 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-19Starting with a change to ensure that ast_verbose() preserves ABI compatibilitytilghman1-28/+36
in 1.6.1 (as compared to 1.6.0 and versions of 1.4), this change also deprecates the use of Asterisk with FreeBSD 4, given the central use of va_copy in core functions. va_copy() is C99, anyway, and we already require C99 for other purposes, so this isn't really a big change anyway. This change also simplifies some of the core ast_str_* functions. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@157639 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-02bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 ↵kpfleming1-2/+5
branch, and add the ones needed for all the new code here too git-svn-id: http://svn.digium.com/svn/asterisk/trunk@153616 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-23Merged revisions 132872 via svnmerge from kpfleming1-11/+42
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r132872 | kpfleming | 2008-07-23 06:52:18 -0500 (Wed, 23 Jul 2008) | 2 lines minor optimization for stringfields: when a field is being set to a larger value than it currently contains and it happens to be the most recent field allocated from the currentl pool, it is possible to 'grow' it without having to waste the space it is currently using (or potentially even allocate a new pool) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@132964 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-11Janitor patch to change uses of sizeof to ARRAY_LENbbryant1-1/+1
(closes issue #13054) Reported by: pabelanger Patches: ARRAY_LEN.patch2 uploaded by pabelanger (license 224) Tested by: seanbright git-svn-id: http://svn.digium.com/svn/asterisk/trunk@130129 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-27Merged revisions 125793 via svnmerge from tilghman1-4/+4
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r125793 | tilghman | 2008-06-27 08:45:03 -0500 (Fri, 27 Jun 2008) | 2 lines In this debugging function, copy to a buffer instead of using potentially unsafe pointers. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@125794 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-26Merged revisions 125587 via svnmerge from qwell1-0/+3
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r125587 | qwell | 2008-06-26 18:03:15 -0500 (Thu, 26 Jun 2008) | 1 line Make sure to unlock the lock_info lock (huh?). Possible deadlock? ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@125589 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-19Add errors that report any locks held by threads when they are being closed.bbryant1-0/+14
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@124064 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-09Expand RQ_INTEGER type out to multiple types, one for each precisiontilghman1-0/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@121367 f38db490-d61c-443f-a65b-d21fe96a405b