diff options
Diffstat (limited to 'src/datacache/plugin_datacache_postgres.c')
-rw-r--r-- | src/datacache/plugin_datacache_postgres.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c index b40f1fd04..e9157742c 100644 --- a/src/datacache/plugin_datacache_postgres.c +++ b/src/datacache/plugin_datacache_postgres.c | |||
@@ -34,7 +34,7 @@ | |||
34 | /** | 34 | /** |
35 | * Per-entry overhead estimate | 35 | * Per-entry overhead estimate |
36 | */ | 36 | */ |
37 | #define OVERHEAD (sizeof(GNUNET_HashCode) + 24) | 37 | #define OVERHEAD (sizeof(struct GNUNET_HashCode) + 24) |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Context for all functions in this plugin. | 40 | * Context for all functions in this plugin. |
@@ -160,7 +160,7 @@ init_connection (struct Plugin *plugin) | |||
160 | * @return 0 on error, number of bytes used otherwise | 160 | * @return 0 on error, number of bytes used otherwise |
161 | */ | 161 | */ |
162 | static size_t | 162 | static size_t |
163 | postgres_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size, | 163 | postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size, |
164 | const char *data, enum GNUNET_BLOCK_Type type, | 164 | const char *data, enum GNUNET_BLOCK_Type type, |
165 | struct GNUNET_TIME_Absolute discard_time) | 165 | struct GNUNET_TIME_Absolute discard_time) |
166 | { | 166 | { |
@@ -178,7 +178,7 @@ postgres_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size, | |||
178 | int paramLengths[] = { | 178 | int paramLengths[] = { |
179 | sizeof (btype), | 179 | sizeof (btype), |
180 | sizeof (bexpi), | 180 | sizeof (bexpi), |
181 | sizeof (GNUNET_HashCode), | 181 | sizeof (struct GNUNET_HashCode), |
182 | size | 182 | size |
183 | }; | 183 | }; |
184 | const int paramFormats[] = { 1, 1, 1, 1 }; | 184 | const int paramFormats[] = { 1, 1, 1, 1 }; |
@@ -206,7 +206,7 @@ postgres_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size, | |||
206 | * @return the number of results found | 206 | * @return the number of results found |
207 | */ | 207 | */ |
208 | static unsigned int | 208 | static unsigned int |
209 | postgres_plugin_get (void *cls, const GNUNET_HashCode * key, | 209 | postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key, |
210 | enum GNUNET_BLOCK_Type type, | 210 | enum GNUNET_BLOCK_Type type, |
211 | GNUNET_DATACACHE_Iterator iter, void *iter_cls) | 211 | GNUNET_DATACACHE_Iterator iter, void *iter_cls) |
212 | { | 212 | { |
@@ -218,7 +218,7 @@ postgres_plugin_get (void *cls, const GNUNET_HashCode * key, | |||
218 | (const char *) &btype, | 218 | (const char *) &btype, |
219 | }; | 219 | }; |
220 | int paramLengths[] = { | 220 | int paramLengths[] = { |
221 | sizeof (GNUNET_HashCode), | 221 | sizeof (struct GNUNET_HashCode), |
222 | sizeof (btype), | 222 | sizeof (btype), |
223 | }; | 223 | }; |
224 | const int paramFormats[] = { 1, 1 }; | 224 | const int paramFormats[] = { 1, 1 }; |
@@ -298,7 +298,7 @@ postgres_plugin_del (void *cls) | |||
298 | struct Plugin *plugin = cls; | 298 | struct Plugin *plugin = cls; |
299 | uint32_t size; | 299 | uint32_t size; |
300 | uint32_t oid; | 300 | uint32_t oid; |
301 | GNUNET_HashCode key; | 301 | struct GNUNET_HashCode key; |
302 | PGresult *res; | 302 | PGresult *res; |
303 | 303 | ||
304 | res = PQexecPrepared (plugin->dbh, "getm", 0, NULL, NULL, NULL, 1); | 304 | res = PQexecPrepared (plugin->dbh, "getm", 0, NULL, NULL, NULL, 1); |
@@ -319,7 +319,7 @@ postgres_plugin_del (void *cls) | |||
319 | } | 319 | } |
320 | if ((3 != PQnfields (res)) || (sizeof (size) != PQfsize (res, 0)) || | 320 | if ((3 != PQnfields (res)) || (sizeof (size) != PQfsize (res, 0)) || |
321 | (sizeof (oid) != PQfsize (res, 1)) || | 321 | (sizeof (oid) != PQfsize (res, 1)) || |
322 | (sizeof (GNUNET_HashCode) != PQgetlength (res, 0, 2))) | 322 | (sizeof (struct GNUNET_HashCode) != PQgetlength (res, 0, 2))) |
323 | { | 323 | { |
324 | GNUNET_break (0); | 324 | GNUNET_break (0); |
325 | PQclear (res); | 325 | PQclear (res); |
@@ -327,7 +327,7 @@ postgres_plugin_del (void *cls) | |||
327 | } | 327 | } |
328 | size = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0)); | 328 | size = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0)); |
329 | oid = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1)); | 329 | oid = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1)); |
330 | memcpy (&key, PQgetvalue (res, 0, 2), sizeof (GNUNET_HashCode)); | 330 | memcpy (&key, PQgetvalue (res, 0, 2), sizeof (struct GNUNET_HashCode)); |
331 | PQclear (res); | 331 | PQclear (res); |
332 | if (GNUNET_OK != GNUNET_POSTGRES_delete_by_rowid (plugin->dbh, "delrow", oid)) | 332 | if (GNUNET_OK != GNUNET_POSTGRES_delete_by_rowid (plugin->dbh, "delrow", oid)) |
333 | return GNUNET_SYSERR; | 333 | return GNUNET_SYSERR; |