1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-22 14:32:25 +03:00

Some cleanup in ecpg code:

Use bool as type for booleans instead of int.
Do not implicitely cast size_t to int.
Make the compiler stop complaining about unused variables by adding an empty statement.
This commit is contained in:
Michael Meskes
2010-11-02 18:12:01 +01:00
parent 8c843fff2d
commit 35d5d962e1
8 changed files with 30 additions and 18 deletions

View File

@@ -100,7 +100,7 @@ replace_variables(char **text, int lineno)
}
static bool
prepare_common(int lineno, struct connection * con, const bool questionmarks, const char *name, const char *variable)
prepare_common(int lineno, struct connection * con, const char *name, const char *variable)
{
struct statement *stmt;
struct prepared_statement *this;
@@ -156,7 +156,7 @@ prepare_common(int lineno, struct connection * con, const bool questionmarks, co
}
/* handle the EXEC SQL PREPARE statement */
/* questionmarks is not needed but remians in there for the time being to not change the API */
/* questionmarks is not needed but remains in there for the time being to not change the API */
bool
ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, const char *name, const char *variable)
{
@@ -164,6 +164,7 @@ ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, c
struct prepared_statement *this,
*prev;
(void) questionmarks; /* quiet the compiler */
con = ecpg_get_connection(connection_name);
if (!ecpg_init(con, connection_name, lineno))
@@ -174,7 +175,7 @@ ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, c
if (this && !deallocate_one(lineno, ECPG_COMPAT_PGSQL, con, prev, this))
return false;
return prepare_common(lineno, con, questionmarks, name, variable);
return prepare_common(lineno, con, name, variable);
}
struct prepared_statement *
@@ -304,6 +305,7 @@ ecpg_prepared(const char *name, struct connection * con)
char *
ECPGprepared_statement(const char *connection_name, const char *name, int lineno)
{
(void)lineno; /* keep the compiler quiet */
return ecpg_prepared(name, ecpg_get_connection(connection_name));
}
@@ -484,7 +486,7 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha
con = ecpg_get_connection(connection_name);
prep = ecpg_find_prepared_statement(stmtID, con, NULL);
/* This prepared name doesn't exist on this connection. */
if (!prep && !prepare_common(lineno, con, 0, stmtID, query))
if (!prep && !prepare_common(lineno, con, stmtID, query))
return (false);
*name = ecpg_strdup(stmtID, lineno);