mirror of
https://github.com/postgres/postgres.git
synced 2025-08-21 10:42:50 +03:00
Backported va_list handling cleanup
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38.4.10 2006/08/18 16:33:50 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38.4.11 2007/02/06 09:42:08 meskes Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The aim is to get a simpler inteface to the database routines.
|
* The aim is to get a simpler inteface to the database routines.
|
||||||
@@ -127,7 +127,6 @@ ECPGget_variable(va_list APREF, enum ECPGttype type, struct variable * var, bool
|
|||||||
var->ind_varcharsize = 0;
|
var->ind_varcharsize = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef APREF
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create a list of variables
|
* create a list of variables
|
||||||
@@ -148,7 +147,7 @@ ECPGget_variable(va_list APREF, enum ECPGttype type, struct variable * var, bool
|
|||||||
* ind_offset - indicator offset
|
* ind_offset - indicator offset
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
create_statement(int lineno, int compat, int force_indicator, struct connection * connection, struct statement ** stmt, const char *query, va_list ap)
|
create_statement(int lineno, int compat, int force_indicator, struct connection * connection, struct statement ** stmt, const char *query, va_list APREF)
|
||||||
{
|
{
|
||||||
struct variable **list = &((*stmt)->inlist);
|
struct variable **list = &((*stmt)->inlist);
|
||||||
enum ECPGttype type;
|
enum ECPGttype type;
|
||||||
@@ -164,7 +163,7 @@ create_statement(int lineno, int compat, int force_indicator, struct connection
|
|||||||
|
|
||||||
list = &((*stmt)->inlist);
|
list = &((*stmt)->inlist);
|
||||||
|
|
||||||
type = va_arg(ap, enum ECPGttype);
|
type = va_arg(APREF, enum ECPGttype);
|
||||||
|
|
||||||
while (type != ECPGt_EORT)
|
while (type != ECPGt_EORT)
|
||||||
{
|
{
|
||||||
@@ -178,11 +177,7 @@ create_statement(int lineno, int compat, int force_indicator, struct connection
|
|||||||
if (!(var = (struct variable *) ECPGalloc(sizeof(struct variable), lineno)))
|
if (!(var = (struct variable *) ECPGalloc(sizeof(struct variable), lineno)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__) || defined(__x86_64__))
|
|
||||||
ECPGget_variable(ap, type, var, true);
|
ECPGget_variable(ap, type, var, true);
|
||||||
#else
|
|
||||||
ECPGget_variable(&ap, type, var, true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* if variable is NULL, the statement hasn't been prepared */
|
/* if variable is NULL, the statement hasn't been prepared */
|
||||||
if (var->pointer == NULL)
|
if (var->pointer == NULL)
|
||||||
@@ -200,7 +195,7 @@ create_statement(int lineno, int compat, int force_indicator, struct connection
|
|||||||
ptr->next = var;
|
ptr->next = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = va_arg(ap, enum ECPGttype);
|
type = va_arg(APREF, enum ECPGttype);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
@@ -1482,7 +1477,11 @@ ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name,
|
|||||||
|
|
||||||
/* construct statement in our own structure */
|
/* construct statement in our own structure */
|
||||||
va_start(args, query);
|
va_start(args, query);
|
||||||
|
#if defined(__GNUC__) && (defined (__powerpc__) || defined(__amd64__) || defined(__x86_64__))
|
||||||
if (create_statement(lineno, compat, force_indicator, con, &stmt, query, args) == false)
|
if (create_statement(lineno, compat, force_indicator, con, &stmt, query, args) == false)
|
||||||
|
#else
|
||||||
|
if (create_statement(lineno, compat, force_indicator, con, &stmt, query, &args) == false)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
setlocale(LC_NUMERIC, oldlocale);
|
setlocale(LC_NUMERIC, oldlocale);
|
||||||
ECPGfree(oldlocale);
|
ECPGfree(oldlocale);
|
||||||
|
Reference in New Issue
Block a user