From: Tilghman Lesher Date: Thu, 28 Jun 2007 19:41:18 +0000 (+0000) Subject: Remove the ill-advised ast_restrdupa API call and related structures X-Git-Tag: 1.6.0-beta1~3^2~2208 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a952147446af3305e46ea1c7139c951c2f777752;p=thirdparty%2Fasterisk.git Remove the ill-advised ast_restrdupa API call and related structures git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@72492 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index ab610982c0..d1799de519 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -244,24 +244,6 @@ void ast_join(char *s, size_t len, char * const w[]); */ int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed); -/* The realloca lets us ast_restrdupa(), but you can't mix any other ast_strdup calls! */ - -struct ast_realloca { - char *ptr; - int alloclen; -}; - -#define ast_restrdupa(ra, s) \ - ({ \ - if ((ra)->ptr && strlen(s) + 1 < (ra)->alloclen) { \ - strcpy((ra)->ptr, s); \ - } else { \ - (ra)->ptr = alloca(strlen(s) + 1 - (ra)->alloclen); \ - if ((ra)->ptr) (ra)->alloclen = strlen(s) + 1; \ - } \ - (ra)->ptr; \ - }) - /*! * Support for dynamic strings. * diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index ae712042aa..7715166b4a 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -220,7 +220,6 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char * struct ast_variable *var=NULL; struct ast_config *cfg=NULL; struct ast_category *cat=NULL; - struct ast_realloca ra; SQLULEN colsize; SQLSMALLINT colcount=0; SQLSMALLINT datatype; @@ -230,11 +229,9 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char * va_list aq; va_copy(aq, ap); - - + if (!table) return NULL; - memset(&ra, 0, sizeof(ra)); obj = ast_odbc_request_obj(database, 0); if (!obj) diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index 821f32cc0c..e8993dd867 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -208,7 +208,6 @@ static struct ast_config *realtime_multi_pgsql(const char *database, const char char *chunk; char *op; const char *newparam, *newval; - struct ast_realloca ra; struct ast_variable *var = NULL; struct ast_config *cfg = NULL; struct ast_category *cat = NULL; @@ -218,8 +217,6 @@ static struct ast_config *realtime_multi_pgsql(const char *database, const char return NULL; } - memset(&ra, 0, sizeof(ra)); - if (!(cfg = ast_config_new())) return NULL;