Commit Graph

24 Commits

Author SHA1 Message Date
Russell Bryant 4b3a3fb14c Add a new API call for creating detached threads. Then, go replace all of the
places in the code where the same block of code for creating detached threads
was replicated.  (patch from bbryant)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-24 18:30:19 +00:00
Joshua Colp 21b53af31d Cosmetic changes. Make main source files better conform to coding guidelines and standards. (issue #8679 reported by johann8384)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51486 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-23 00:11:32 +00:00
Tilghman Lesher a48fdb83a5 Merged revisions 51195 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r51195 | tilghman | 2007-01-17 14:56:15 -0600 (Wed, 17 Jan 2007) | 12 lines

Merged revisions 51194 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51194 | tilghman | 2007-01-17 14:52:21 -0600 (Wed, 17 Jan 2007) | 4 lines

When ast_strip_quoted was called with a zero-length string, it would treat a
NULL as if it were the quoting character (and would thus return the string
in memory immediately following the passed-in string).

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51196 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-17 20:57:51 +00:00
Luigi Rizzo 2703a1a9df forgot this part...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-16 11:23:07 +00:00
Luigi Rizzo 055abfe9d9 simplify the ast_dynamic_str_*.... routines by
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-15 23:10:42 +00:00
Luigi Rizzo 961754d4b1 move the dynamic string support in a better place i.e. string.h
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-12-15 22:08:46 +00:00
Russell Bryant eaf98f31e8 Go ahead and make this write unconditional. Making it conditional is more work
in both the append and non-append modes.  Also, always truncating the partial
write makes the behavior of the function more consistent, where in any type of
write, no partial result is left in the buffer.

Thanks for the feedback, luigi


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48109 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-29 17:37:31 +00:00
Russell Bryant 8ca3d51634 Remove an XXX command suggesting that this truncation should not be conditional,
and also add a more verbose comment explaining why it is only needed in the
case of appending to the string for any curious readers that come along in the
future.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-29 05:08:19 +00:00
Luigi Rizzo 5e7aebf9ac some simplifications to
ast_dynamic_str_thread_build_va_couldnt_we_choose_a_shorter_name()

I am unsure whether the truncation of the string in case of a failed
attempt should be done unconditionally. See the XXX mark.

Russel, ideas ?



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48084 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-28 14:07:09 +00:00
Steve Murphy 908f176cf3 A fair number of changes for the sake of bug 7506
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47290 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-07 21:47:49 +00:00
Luigi Rizzo 403135f646 explain why ast_carefulwrite is written the way it is,
and also that it doesn't really work as claimed.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47242 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-07 08:34:26 +00:00
Russell Bryant 2e5e32c574 Merged revisions 46561 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r46561 | russell | 2006-10-31 01:19:56 -0500 (Tue, 31 Oct 2006) | 11 lines

Merged revisions 46560 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r46560 | russell | 2006-10-31 01:18:36 -0500 (Tue, 31 Oct 2006) | 3 lines

When handling the case where the hostname is just an IPV4 numeric address,
be sure to set the address type.  (issue #8247, alexr)

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46562 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-31 06:21:40 +00:00
Kevin P. Fleming 749029de38 Merged revisions 46200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46200 | kpfleming | 2006-10-25 09:32:08 -0500 (Wed, 25 Oct 2006) | 2 lines

apparently developers are still not aware that they should be use ast_copy_string instead of strncpy... fix up many more users, and fix some bugs in the process

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-25 14:44:50 +00:00
Luigi Rizzo 9bbf557dfb use autodetected support for gethostbyname_r
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45989 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-23 16:54:54 +00:00
Russell Bryant bd53e7ee4c Extend the thread storage API such that a custom initialization function can
be called for each thread specific object after they are allocated.  Note that
there was already the ability to define a custom cleanup function.  Also, if
the custom cleanup function is used, it *MUST* call free on the thread
specific object at the end.  There is no way to have this magically done that
I can think of because the cleanup function registered with the pthread
implementation will only call the function back with a pointer to the
thread specific object, not the parent ast_threadstorage object.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-19 01:00:57 +00:00
Kevin P. Fleming 0638096e5c Merged revisions 45027 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r45027 | kpfleming | 2006-10-13 10:41:14 -0500 (Fri, 13 Oct 2006) | 2 lines

use a configure script test for PMTU discovery control instead of just assuming it's available on Linux

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-13 15:47:42 +00:00
Kevin P. Fleming 035aeb82e4 Merged revisions 44956 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r44956 | kpfleming | 2006-10-12 13:38:51 -0500 (Thu, 12 Oct 2006) | 10 lines

Merged revisions 44955 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r44955 | kpfleming | 2006-10-12 13:31:26 -0500 (Thu, 12 Oct 2006) | 2 lines

ensure that IAX2 and SIP sockets allow UDP fragmentation when running on Linux (thanks to Brian Candler on the asterisk-dev list for the tip)

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-12 18:43:52 +00:00
Kevin P. Fleming c28461197b Merged revisions 44390 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44390 | kpfleming | 2006-10-04 16:04:21 -0500 (Wed, 04 Oct 2006) | 2 lines

make LOW_MEMORY builds actually work

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-04 21:10:36 +00:00
Kevin P. Fleming 3c876af5cf Merged revisions 44378 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44378 | kpfleming | 2006-10-04 14:47:22 -0500 (Wed, 04 Oct 2006) | 4 lines

update thread creation code a bit
reduce standard thread stack size slightly to allow the pthreads library to allocate the stack+data and not overflow a power-of-2 allocation in the kernel and waste memory/address space
add a new stack size for 'background' threads (those that don't handle PBX calls) when LOW_MEMORY is defined

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44379 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-04 19:51:38 +00:00
Jason Parker f18cbf77df Many Solaris fixes - this moves some of the stuff from utils.c to strcompat.c
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-09-15 17:16:00 +00:00
Kevin P. Fleming d5f812e0b1 don't try to get the length of the string in the ast_dynamic_str object unless we know there is actually one there
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@42185 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-07 00:41:27 +00:00
Russell Bryant 3057660a79 when calling this function to append to a dynamic string and the buffer was not
large enough and had to be reallocated, cut off the partially appended data.
Otherwise, the function will get called over and over again appending to the
end every time and never thinking it has enough room.

Thanks to jmls for access to his machine for debugging!

(issue #7691)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41944 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-03 22:56:01 +00:00
Tilghman Lesher d2b7882788 Off by one error in buffer length (issue 7379)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-25 17:48:34 +00:00
Kevin P. Fleming 0a27d8bfe5 merge new_loader_completion branch, including (at least):
- restructured build tree and makefiles to eliminate recursion problems
  - support for embedded modules
  - support for static builds
  - simpler cross-compilation support
  - simpler module/loader interface (no exported symbols)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40722 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-21 02:11:39 +00:00