aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2012-03-02 20:51:29 +0200
committerPeter Eisentraut <peter_e@gmx.net>2012-03-02 20:51:29 +0200
commitd41f510c807ce8b12c572196e2ae8f3817ac253a (patch)
treed26e20c85abba72f626ae0555cb39e70545cb5e5
parent8efb0bc57eb350bd991fd32c96e38a13bfe7f120 (diff)
downloadpostgresql-d41f510c807ce8b12c572196e2ae8f3817ac253a.tar.gz
postgresql-d41f510c807ce8b12c572196e2ae8f3817ac253a.zip
ecpg: Clean up some const usage
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c12
-rw-r--r--src/interfaces/ecpg/ecpglib/prepare.c4
-rw-r--r--src/interfaces/ecpg/preproc/descriptor.c10
3 files changed, 13 insertions, 13 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index f468147b295..311bc5cbc50 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1083,7 +1083,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
}
static void
-free_params(const char **paramValues, int nParams, bool print, int lineno)
+free_params(char **paramValues, int nParams, bool print, int lineno)
{
int n;
@@ -1091,7 +1091,7 @@ free_params(const char **paramValues, int nParams, bool print, int lineno)
{
if (print)
ecpg_log("free_params on line %d: parameter %d = %s\n", lineno, n + 1, paramValues[n] ? paramValues[n] : "null");
- ecpg_free((void *) (paramValues[n]));
+ ecpg_free(paramValues[n]);
}
ecpg_free(paramValues);
}
@@ -1138,7 +1138,7 @@ ecpg_execute(struct statement * stmt)
PGnotify *notify;
struct variable *var;
int desc_counter = 0;
- const char **paramValues = NULL;
+ char **paramValues = NULL;
int nParams = 0;
int position = 0;
struct sqlca_t *sqlca = ECPGget_sqlca();
@@ -1380,7 +1380,7 @@ ecpg_execute(struct statement * stmt)
else
{
nParams++;
- if (!(paramValues = (const char **) ecpg_realloc(paramValues, sizeof(const char *) * nParams, stmt->lineno)))
+ if (!(paramValues = (char **) ecpg_realloc(paramValues, sizeof(char *) * nParams, stmt->lineno)))
{
ecpg_free(paramValues);
return false;
@@ -1441,7 +1441,7 @@ ecpg_execute(struct statement * stmt)
ecpg_log("ecpg_execute on line %d: query: %s; with %d parameter(s) on connection %s\n", stmt->lineno, stmt->command, nParams, stmt->connection->name);
if (stmt->statement_type == ECPGst_execute)
{
- results = PQexecPrepared(stmt->connection->connection, stmt->name, nParams, paramValues, NULL, NULL, 0);
+ results = PQexecPrepared(stmt->connection->connection, stmt->name, nParams, (const char *const*) paramValues, NULL, NULL, 0);
ecpg_log("ecpg_execute on line %d: using PQexecPrepared for \"%s\"\n", stmt->lineno, stmt->command);
}
else
@@ -1453,7 +1453,7 @@ ecpg_execute(struct statement * stmt)
}
else
{
- results = PQexecParams(stmt->connection->connection, stmt->command, nParams, NULL, paramValues, NULL, NULL, 0);
+ results = PQexecParams(stmt->connection->connection, stmt->command, nParams, NULL, (const char *const*) paramValues, NULL, NULL, 0);
ecpg_log("ecpg_execute on line %d: using PQexecParams\n", stmt->lineno);
}
}
diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c
index c5a554e8e28..1bddf215afe 100644
--- a/src/interfaces/ecpg/ecpglib/prepare.c
+++ b/src/interfaces/ecpg/ecpglib/prepare.c
@@ -19,7 +19,7 @@ typedef struct
char stmtID[STMTID_SIZE];
char *ecpgQuery;
long execs; /* # of executions */
- char *connection; /* connection for the statement */
+ const char *connection; /* connection for the statement */
} stmtCacheEntry;
static int nextStmtID = 1;
@@ -456,7 +456,7 @@ AddStmtToCache(int lineno, /* line # of statement */
entry = &stmtCacheEntries[entNo];
entry->lineno = lineno;
entry->ecpgQuery = ecpg_strdup(ecpgQuery, lineno);
- entry->connection = (char *) connection;
+ entry->connection = connection;
entry->execs = 0;
memcpy(entry->stmtID, stmtID, sizeof(entry->stmtID));
diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c
index 52865293f24..115cb17ddc1 100644
--- a/src/interfaces/ecpg/preproc/descriptor.c
+++ b/src/interfaces/ecpg/preproc/descriptor.c
@@ -317,14 +317,14 @@ struct variable *
descriptor_variable(const char *name, int input)
{
static char descriptor_names[2][MAX_DESCRIPTOR_NAMELEN];
- static const struct ECPGtype descriptor_type = {ECPGt_descriptor, NULL, NULL, NULL, {NULL}, 0};
- static const struct variable varspace[2] = {
- {descriptor_names[0], (struct ECPGtype *) & descriptor_type, 0, NULL},
- {descriptor_names[1], (struct ECPGtype *) & descriptor_type, 0, NULL}
+ static struct ECPGtype descriptor_type = {ECPGt_descriptor, NULL, NULL, NULL, {NULL}, 0};
+ static struct variable varspace[2] = {
+ {descriptor_names[0], &descriptor_type, 0, NULL},
+ {descriptor_names[1], &descriptor_type, 0, NULL}
};
strlcpy(descriptor_names[input], name, sizeof(descriptor_names[input]));
- return (struct variable *) & varspace[input];
+ return &varspace[input];
}
struct variable *