Summary:ASTERISK-04485: [patch] simplified string handling in cdr_pgsql and cdr_odbc
Reporter:Luigi Rizzo (rizzo)Labels:
Date Opened:2005-06-26 08:11:54Date Closed:2008-01-15 15:40:45.000-0600
Versions:Frequency of
Environment:Attachments:( 0) cdr.diff
Description:the code in these two files use some convoluted strategy to handle
char * that could be malloced or constant.
This patch (untested) largely simplifies it by always mallocing -- the
overhead is an extra 30-40 bytes for the default strings that we only pay
once at module loading. Surely the code shrinks by a lot more.

On passing. note that SQLConnect might be called with NULL pointers for
username and password. The online doc does not tell if this is legal or
not, but the pgsql equivalent code takes care to supply default strings.


The code could be simplified even more by remembering that after unload,
variables in the module are not used anymore so it is pointless to reset
them to NULL.

I will leave this optimization to the commiter.
Comments:By: Kevin P. Fleming (kpfleming) 2005-07-11 16:58:39

Committed to CVS HEAD with two bug fixes, and with the excess variable resetting removed as well. Thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:40:45.000-0600

Repository: asterisk
Revision: 6085

U   trunk/cdr/cdr_odbc.c
U   trunk/cdr/cdr_pgsql.c

r6085 | kpfleming | 2008-01-15 15:40:44 -0600 (Tue, 15 Jan 2008) | 3 lines

remove complex malloc-avoidance (bug ASTERISK-4485)
remove resetting of variables during unload that will only be freed or set to known values on reload