diff options
author | Michael Meskes <meskes@postgresql.org> | 2010-11-02 18:12:01 +0100 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2010-11-02 18:12:01 +0100 |
commit | 35d5d962e1777560baf6f5edec906a907a853c9a (patch) | |
tree | da8655d2409ebd61863735a1f321052eaedbc636 /src/interfaces/ecpg/ecpglib | |
parent | 8c843fff2d8db7889b81782ab4f3324cbda4ed2a (diff) | |
download | postgresql-35d5d962e1777560baf6f5edec906a907a853c9a.tar.gz postgresql-35d5d962e1777560baf6f5edec906a907a853c9a.zip |
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.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/connect.c | 2 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/extern.h | 2 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/memory.c | 1 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/prepare.c | 10 |
4 files changed, 9 insertions, 6 deletions
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index 0091b5dc98f..3bd6614e723 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -214,9 +214,9 @@ ECPGnoticeReceiver(void *arg, const PGresult *result) char *sqlstate = PQresultErrorField(result, PG_DIAG_SQLSTATE); char *message = PQresultErrorField(result, PG_DIAG_MESSAGE_PRIMARY); struct sqlca_t *sqlca = ECPGget_sqlca(); - int sqlcode; + (void) arg; /* keep the compiler quiet */ if (sqlstate == NULL) sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR; diff --git a/src/interfaces/ecpg/ecpglib/extern.h b/src/interfaces/ecpg/ecpglib/extern.h index 2d9636d798b..0d55102d0da 100644 --- a/src/interfaces/ecpg/ecpglib/extern.h +++ b/src/interfaces/ecpg/ecpglib/extern.h @@ -76,7 +76,7 @@ struct connection { char *name; PGconn *connection; - int autocommit; + bool autocommit; struct ECPGtype_information_cache *cache_head; struct prepared_statement *prep_stmts; struct connection *next; diff --git a/src/interfaces/ecpg/ecpglib/memory.c b/src/interfaces/ecpg/ecpglib/memory.c index 94414b5e992..542bfc0c7d5 100644 --- a/src/interfaces/ecpg/ecpglib/memory.c +++ b/src/interfaces/ecpg/ecpglib/memory.c @@ -75,6 +75,7 @@ static pthread_once_t auto_mem_once = PTHREAD_ONCE_INIT; static void auto_mem_destructor(void *arg) { + (void) arg; /* keep the compiler quiet */ ECPGfree_auto_mem(); } diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c index c2725a231ab..90288d343bf 100644 --- a/src/interfaces/ecpg/ecpglib/prepare.c +++ b/src/interfaces/ecpg/ecpglib/prepare.c @@ -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); |