diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-06-16 20:51:25 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-06-16 20:51:31 +0200 |
commit | 93473ba6b51f1b75959a25602036195c0df0e315 (patch) | |
tree | 277b36ddea17e154d9bdee55c3e9a60e03ec539f /src | |
parent | 1bc1fbda00a9e31d2256c52b29a2c758b7818268 (diff) | |
download | gnunet-93473ba6b51f1b75959a25602036195c0df0e315.tar.gz gnunet-93473ba6b51f1b75959a25602036195c0df0e315.zip |
-debug assist
Diffstat (limited to 'src')
-rw-r--r-- | src/pq/pq.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/pq/pq.c b/src/pq/pq.c index 25202a640..356472fa3 100644 --- a/src/pq/pq.c +++ b/src/pq/pq.c | |||
@@ -128,9 +128,11 @@ GNUNET_PQ_extract_result (PGresult *result, | |||
128 | struct GNUNET_PQ_ResultSpec *rs, | 128 | struct GNUNET_PQ_ResultSpec *rs, |
129 | int row) | 129 | int row) |
130 | { | 130 | { |
131 | unsigned int i; | ||
132 | |||
131 | if (NULL == result) | 133 | if (NULL == result) |
132 | return GNUNET_SYSERR; | 134 | return GNUNET_SYSERR; |
133 | for (unsigned int i = 0; NULL != rs[i].conv; i++) | 135 | for (i = 0; NULL != rs[i].conv; i++) |
134 | { | 136 | { |
135 | struct GNUNET_PQ_ResultSpec *spec; | 137 | struct GNUNET_PQ_ResultSpec *spec; |
136 | enum GNUNET_GenericReturnValue ret; | 138 | enum GNUNET_GenericReturnValue ret; |
@@ -156,18 +158,24 @@ GNUNET_PQ_extract_result (PGresult *result, | |||
156 | *spec->is_null = true; | 158 | *spec->is_null = true; |
157 | continue; | 159 | continue; |
158 | } | 160 | } |
159 | /* intentional fall-through: NULL value for field that is NOT nullable */ | 161 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
162 | "NULL field encountered for `%s' where non-NULL was required\n", | ||
163 | spec->fname); | ||
164 | goto cleanup; | ||
160 | case GNUNET_SYSERR: | 165 | case GNUNET_SYSERR: |
161 | for (unsigned int j = 0; j < i; j++) | 166 | GNUNET_break (0); |
162 | if (NULL != rs[j].cleaner) | 167 | goto cleanup; |
163 | rs[j].cleaner (rs[j].cls, | ||
164 | rs[j].dst); | ||
165 | return GNUNET_SYSERR; | ||
166 | } | 168 | } |
167 | if (NULL != spec->result_size) | 169 | if (NULL != spec->result_size) |
168 | *spec->result_size = spec->dst_size; | 170 | *spec->result_size = spec->dst_size; |
169 | } | 171 | } |
170 | return GNUNET_OK; | 172 | return GNUNET_OK; |
173 | cleanup: | ||
174 | for (unsigned int j = 0; j < i; j++) | ||
175 | if (NULL != rs[j].cleaner) | ||
176 | rs[j].cleaner (rs[j].cls, | ||
177 | rs[j].dst); | ||
178 | return GNUNET_SYSERR; | ||
171 | } | 179 | } |
172 | 180 | ||
173 | 181 | ||