aboutsummaryrefslogtreecommitdiff
path: root/src/my/my.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/my/my.c')
-rw-r--r--src/my/my.c44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/my/my.c b/src/my/my.c
index 459f09b6a..2f4cd3ba3 100644
--- a/src/my/my.c
+++ b/src/my/my.c
@@ -1,21 +1,19 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2016 Inria & GNUnet e.V. 3 Copyright (C) 2016, 2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file my/my.c 19 * @file my/my.c
@@ -45,19 +43,20 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc,
45{ 43{
46 const struct GNUNET_MY_QueryParam *p; 44 const struct GNUNET_MY_QueryParam *p;
47 unsigned int num; 45 unsigned int num;
48 unsigned int i;
49 MYSQL_STMT *stmt; 46 MYSQL_STMT *stmt;
50 47
51 num = 0; 48 num = 0;
52 for (i=0;NULL != params[i].conv;i++) 49 for (unsigned int i=0;NULL != params[i].conv;i++)
53 num += params[i].num_params; 50 num += params[i].num_params;
54 { 51 {
55 MYSQL_BIND qbind[num]; 52 MYSQL_BIND qbind[num];
56 unsigned int off; 53 unsigned int off;
57 54
58 memset (qbind, 0, sizeof(qbind)); 55 memset (qbind,
56 0,
57 sizeof(qbind));
59 off = 0; 58 off = 0;
60 for (i=0;NULL != (p = &params[i])->conv;i++) 59 for (unsigned int i=0;NULL != (p = &params[i])->conv;i++)
61 { 60 {
62 if (GNUNET_OK != 61 if (GNUNET_OK !=
63 p->conv (p->conv_cls, 62 p->conv (p->conv_cls,
@@ -113,9 +112,7 @@ void
113GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp, 112GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp,
114 MYSQL_BIND *qbind) 113 MYSQL_BIND *qbind)
115{ 114{
116 unsigned int i; 115 for (unsigned int i=0; NULL != qp[i].conv ;i++)
117
118 for (i=0; NULL != qp[i].conv ;i++)
119 if (NULL != qp[i].cleaner) 116 if (NULL != qp[i].cleaner)
120 qp[i].cleaner (qp[i].conv_cls, 117 qp[i].cleaner (qp[i].conv_cls,
121 &qbind[i]); 118 &qbind[i]);
@@ -138,7 +135,6 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
138 struct GNUNET_MY_ResultSpec *rs) 135 struct GNUNET_MY_ResultSpec *rs)
139{ 136{
140 unsigned int num_fields; 137 unsigned int num_fields;
141 unsigned int i;
142 int ret; 138 int ret;
143 MYSQL_STMT *stmt; 139 MYSQL_STMT *stmt;
144 140
@@ -155,7 +151,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
155 } 151 }
156 152
157 num_fields = 0; 153 num_fields = 0;
158 for (i=0;NULL != rs[i].pre_conv;i++) 154 for (unsigned int i=0;NULL != rs[i].pre_conv;i++)
159 num_fields += rs[i].num_fields; 155 num_fields += rs[i].num_fields;
160 156
161 if (mysql_stmt_field_count (stmt) != num_fields) 157 if (mysql_stmt_field_count (stmt) != num_fields)
@@ -171,7 +167,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
171 167
172 memset (result, 0, sizeof (MYSQL_BIND) * num_fields); 168 memset (result, 0, sizeof (MYSQL_BIND) * num_fields);
173 field_off = 0; 169 field_off = 0;
174 for (i=0;NULL != rs[i].pre_conv;i++) 170 for (unsigned int i=0;NULL != rs[i].pre_conv;i++)
175 { 171 {
176 struct GNUNET_MY_ResultSpec *rp = &rs[i]; 172 struct GNUNET_MY_ResultSpec *rp = &rs[i];
177 173
@@ -223,7 +219,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
223 return GNUNET_SYSERR; 219 return GNUNET_SYSERR;
224 } 220 }
225 field_off = 0; 221 field_off = 0;
226 for (i=0;NULL != rs[i].post_conv;i++) 222 for (unsigned int i=0;NULL != rs[i].post_conv;i++)
227 { 223 {
228 struct GNUNET_MY_ResultSpec *rp = &rs[i]; 224 struct GNUNET_MY_ResultSpec *rp = &rs[i];
229 225
@@ -258,9 +254,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
258void 254void
259GNUNET_MY_cleanup_result (struct GNUNET_MY_ResultSpec *rs) 255GNUNET_MY_cleanup_result (struct GNUNET_MY_ResultSpec *rs)
260{ 256{
261 unsigned int i; 257 for (unsigned int i=0;NULL != rs[i].post_conv;i++)
262
263 for (i=0;NULL != rs[i].post_conv;i++)
264 if (NULL != rs[i].cleaner) 258 if (NULL != rs[i].cleaner)
265 rs[i].cleaner (rs[i].conv_cls, 259 rs[i].cleaner (rs[i].conv_cls,
266 &rs[i]); 260 &rs[i]);