summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/data.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:00 +0200
commitb46f5ebd9c8f6ec37e27c56749266fc2e362902b (patch)
treea88810cf43973c62f0f8ab2f084b36affb0ed916 /src/interfaces/ecpg/ecpglib/data.c
parent866a034c3f9f2b6c3ef23df0f1d9e2e4b7533a3a (diff)
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/data.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/data.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index 8d36484f73a..82ab4aaf868 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -423,27 +423,13 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_bool:
if (pval[0] == 'f' && pval[1] == '\0')
{
- if (offset == sizeof(char))
- *((char *) (var + offset * act_tuple)) = false;
- else if (offset == sizeof(int))
- *((int *) (var + offset * act_tuple)) = false;
- else
- ecpg_raise(lineno, ECPG_CONVERT_BOOL,
- ECPG_SQLSTATE_DATATYPE_MISMATCH,
- NULL);
+ *((bool *) (var + offset * act_tuple)) = false;
pval++;
break;
}
else if (pval[0] == 't' && pval[1] == '\0')
{
- if (offset == sizeof(char))
- *((char *) (var + offset * act_tuple)) = true;
- else if (offset == sizeof(int))
- *((int *) (var + offset * act_tuple)) = true;
- else
- ecpg_raise(lineno, ECPG_CONVERT_BOOL,
- ECPG_SQLSTATE_DATATYPE_MISMATCH,
- NULL);
+ *((bool *) (var + offset * act_tuple)) = true;
pval++;
break;
}