diff options
Diffstat (limited to 'src/my/my.c')
-rw-r--r-- | src/my/my.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/my/my.c b/src/my/my.c index b9d5c8424..2f4cd3ba3 100644 --- a/src/my/my.c +++ b/src/my/my.c | |||
@@ -1,6 +1,6 @@ | |||
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 it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -43,19 +43,20 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc, | |||
43 | { | 43 | { |
44 | const struct GNUNET_MY_QueryParam *p; | 44 | const struct GNUNET_MY_QueryParam *p; |
45 | unsigned int num; | 45 | unsigned int num; |
46 | unsigned int i; | ||
47 | MYSQL_STMT *stmt; | 46 | MYSQL_STMT *stmt; |
48 | 47 | ||
49 | num = 0; | 48 | num = 0; |
50 | for (i=0;NULL != params[i].conv;i++) | 49 | for (unsigned int i=0;NULL != params[i].conv;i++) |
51 | num += params[i].num_params; | 50 | num += params[i].num_params; |
52 | { | 51 | { |
53 | MYSQL_BIND qbind[num]; | 52 | MYSQL_BIND qbind[num]; |
54 | unsigned int off; | 53 | unsigned int off; |
55 | 54 | ||
56 | memset (qbind, 0, sizeof(qbind)); | 55 | memset (qbind, |
56 | 0, | ||
57 | sizeof(qbind)); | ||
57 | off = 0; | 58 | off = 0; |
58 | for (i=0;NULL != (p = ¶ms[i])->conv;i++) | 59 | for (unsigned int i=0;NULL != (p = ¶ms[i])->conv;i++) |
59 | { | 60 | { |
60 | if (GNUNET_OK != | 61 | if (GNUNET_OK != |
61 | p->conv (p->conv_cls, | 62 | p->conv (p->conv_cls, |
@@ -111,9 +112,7 @@ void | |||
111 | GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp, | 112 | GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp, |
112 | MYSQL_BIND *qbind) | 113 | MYSQL_BIND *qbind) |
113 | { | 114 | { |
114 | unsigned int i; | 115 | for (unsigned int i=0; NULL != qp[i].conv ;i++) |
115 | |||
116 | for (i=0; NULL != qp[i].conv ;i++) | ||
117 | if (NULL != qp[i].cleaner) | 116 | if (NULL != qp[i].cleaner) |
118 | qp[i].cleaner (qp[i].conv_cls, | 117 | qp[i].cleaner (qp[i].conv_cls, |
119 | &qbind[i]); | 118 | &qbind[i]); |
@@ -136,7 +135,6 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, | |||
136 | struct GNUNET_MY_ResultSpec *rs) | 135 | struct GNUNET_MY_ResultSpec *rs) |
137 | { | 136 | { |
138 | unsigned int num_fields; | 137 | unsigned int num_fields; |
139 | unsigned int i; | ||
140 | int ret; | 138 | int ret; |
141 | MYSQL_STMT *stmt; | 139 | MYSQL_STMT *stmt; |
142 | 140 | ||
@@ -153,7 +151,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, | |||
153 | } | 151 | } |
154 | 152 | ||
155 | num_fields = 0; | 153 | num_fields = 0; |
156 | for (i=0;NULL != rs[i].pre_conv;i++) | 154 | for (unsigned int i=0;NULL != rs[i].pre_conv;i++) |
157 | num_fields += rs[i].num_fields; | 155 | num_fields += rs[i].num_fields; |
158 | 156 | ||
159 | if (mysql_stmt_field_count (stmt) != num_fields) | 157 | if (mysql_stmt_field_count (stmt) != num_fields) |
@@ -169,7 +167,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, | |||
169 | 167 | ||
170 | memset (result, 0, sizeof (MYSQL_BIND) * num_fields); | 168 | memset (result, 0, sizeof (MYSQL_BIND) * num_fields); |
171 | field_off = 0; | 169 | field_off = 0; |
172 | for (i=0;NULL != rs[i].pre_conv;i++) | 170 | for (unsigned int i=0;NULL != rs[i].pre_conv;i++) |
173 | { | 171 | { |
174 | struct GNUNET_MY_ResultSpec *rp = &rs[i]; | 172 | struct GNUNET_MY_ResultSpec *rp = &rs[i]; |
175 | 173 | ||
@@ -221,7 +219,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, | |||
221 | return GNUNET_SYSERR; | 219 | return GNUNET_SYSERR; |
222 | } | 220 | } |
223 | field_off = 0; | 221 | field_off = 0; |
224 | for (i=0;NULL != rs[i].post_conv;i++) | 222 | for (unsigned int i=0;NULL != rs[i].post_conv;i++) |
225 | { | 223 | { |
226 | struct GNUNET_MY_ResultSpec *rp = &rs[i]; | 224 | struct GNUNET_MY_ResultSpec *rp = &rs[i]; |
227 | 225 | ||
@@ -256,9 +254,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, | |||
256 | void | 254 | void |
257 | GNUNET_MY_cleanup_result (struct GNUNET_MY_ResultSpec *rs) | 255 | GNUNET_MY_cleanup_result (struct GNUNET_MY_ResultSpec *rs) |
258 | { | 256 | { |
259 | unsigned int i; | 257 | for (unsigned int i=0;NULL != rs[i].post_conv;i++) |
260 | |||
261 | for (i=0;NULL != rs[i].post_conv;i++) | ||
262 | if (NULL != rs[i].cleaner) | 258 | if (NULL != rs[i].cleaner) |
263 | rs[i].cleaner (rs[i].conv_cls, | 259 | rs[i].cleaner (rs[i].conv_cls, |
264 | &rs[i]); | 260 | &rs[i]); |