aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2015-09-17 15:41:04 +0200
committerMichael Meskes <meskes@postgresql.org>2015-09-19 11:13:13 +0200
commitf38070d630149a98984a7145093e08706ad99828 (patch)
tree9f59d49414597e0b9f79a79c150a8079eab2f79f /src/interfaces/ecpg/ecpglib/execute.c
parentf7d896ab919af6ef74117c6121443721902beba3 (diff)
downloadpostgresql-f38070d630149a98984a7145093e08706ad99828.tar.gz
postgresql-f38070d630149a98984a7145093e08706ad99828.zip
Let compiler handle size calculation of bool types.
Back in the day this did not work, but modern compilers should handle it themselves.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index eaf62d1e5ae..dbf326daebe 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -752,18 +752,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
{
strcpy(mallocedval, "{");
- if (var->offset == sizeof(char))
- for (element = 0; element < asize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%c,", (((char *) var->value)[element]) ? 't' : 'f');
+ for (element = 0; element < asize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%c,", (((bool *) var->value)[element]) ? 't' : 'f');
- /*
- * this is necessary since sizeof(C++'s bool)==sizeof(int)
- */
- else if (var->offset == sizeof(int))
- for (element = 0; element < asize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%c,", (((int *) var->value)[element]) ? 't' : 'f');
- else
- ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL);
strcpy(mallocedval + strlen(mallocedval) - 1, "}");
}