diff options
author | LRN <lrn1986@gmail.com> | 2013-12-19 06:00:23 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2013-12-19 06:00:23 +0000 |
commit | e0ca7357cd0bfedc5c29cb731b56279fef8da059 (patch) | |
tree | ecfd47cf59bc00e656b53fd59c58f5038e342d65 /src/datastore | |
parent | 92fd84dc7ef98452f848a62677c61a2b80b5835e (diff) | |
download | gnunet-e0ca7357cd0bfedc5c29cb731b56279fef8da059.tar.gz gnunet-e0ca7357cd0bfedc5c29cb731b56279fef8da059.zip |
malloc -> new
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/gnunet-service-datastore.c | 8 | ||||
-rw-r--r-- | src/datastore/perf_datastore_api.c | 2 | ||||
-rw-r--r-- | src/datastore/perf_plugin_datastore.c | 2 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_heap.c | 6 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_mysql.c | 4 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_postgres.c | 4 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 2 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_template.c | 4 | ||||
-rw-r--r-- | src/datastore/test_datastore_api.c | 2 | ||||
-rw-r--r-- | src/datastore/test_datastore_api_management.c | 2 | ||||
-rw-r--r-- | src/datastore/test_plugin_datastore.c | 2 |
11 files changed, 19 insertions, 19 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index 7c4c47e90..98ef6d797 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c | |||
@@ -516,7 +516,7 @@ transmit (struct GNUNET_SERVER_Client *client, struct GNUNET_MessageHeader *msg) | |||
516 | GNUNET_free (msg); | 516 | GNUNET_free (msg); |
517 | return; | 517 | return; |
518 | } | 518 | } |
519 | tcc = GNUNET_malloc (sizeof (struct TransmitCallbackContext)); | 519 | tcc = GNUNET_new (struct TransmitCallbackContext); |
520 | tcc->msg = msg; | 520 | tcc->msg = msg; |
521 | tcc->client = client; | 521 | tcc->client = client; |
522 | if (NULL == | 522 | if (NULL == |
@@ -598,7 +598,7 @@ transmit_item (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
598 | /* transmit 'DATA_END' */ | 598 | /* transmit 'DATA_END' */ |
599 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' message\n", | 599 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' message\n", |
600 | "DATA_END"); | 600 | "DATA_END"); |
601 | end = GNUNET_malloc (sizeof (struct GNUNET_MessageHeader)); | 601 | end = GNUNET_new (struct GNUNET_MessageHeader); |
602 | end->size = htons (sizeof (struct GNUNET_MessageHeader)); | 602 | end->size = htons (sizeof (struct GNUNET_MessageHeader)); |
603 | end->type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END); | 603 | end->type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END); |
604 | transmit (client, end); | 604 | transmit (client, end); |
@@ -698,7 +698,7 @@ handle_reserve (void *cls, struct GNUNET_SERVER_Client *client, | |||
698 | reserved += req; | 698 | reserved += req; |
699 | GNUNET_STATISTICS_set (stats, gettext_noop ("# reserved"), reserved, | 699 | GNUNET_STATISTICS_set (stats, gettext_noop ("# reserved"), reserved, |
700 | GNUNET_NO); | 700 | GNUNET_NO); |
701 | e = GNUNET_malloc (sizeof (struct ReservationList)); | 701 | e = GNUNET_new (struct ReservationList); |
702 | e->next = reservations; | 702 | e->next = reservations; |
703 | reservations = e; | 703 | reservations = e; |
704 | e->client = client; | 704 | e->client = client; |
@@ -1274,7 +1274,7 @@ load_plugin () | |||
1274 | struct DatastorePlugin *ret; | 1274 | struct DatastorePlugin *ret; |
1275 | char *libname; | 1275 | char *libname; |
1276 | 1276 | ||
1277 | ret = GNUNET_malloc (sizeof (struct DatastorePlugin)); | 1277 | ret = GNUNET_new (struct DatastorePlugin); |
1278 | ret->env.cfg = cfg; | 1278 | ret->env.cfg = cfg; |
1279 | ret->env.duc = &disk_utilization_change_cb; | 1279 | ret->env.duc = &disk_utilization_change_cb; |
1280 | ret->env.cls = NULL; | 1280 | ret->env.cls = NULL; |
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index c51502cc6..90f72d6ee 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c | |||
@@ -303,7 +303,7 @@ run (void *cls, | |||
303 | 303 | ||
304 | datastore = GNUNET_DATASTORE_connect (cfg); | 304 | datastore = GNUNET_DATASTORE_connect (cfg); |
305 | start_time = GNUNET_TIME_absolute_get (); | 305 | start_time = GNUNET_TIME_absolute_get (); |
306 | crc = GNUNET_malloc (sizeof (struct CpsRunContext)); | 306 | crc = GNUNET_new (struct CpsRunContext); |
307 | crc->cfg = cfg; | 307 | crc->cfg = cfg; |
308 | crc->phase = RP_PUT; | 308 | crc->phase = RP_PUT; |
309 | if (NULL == | 309 | if (NULL == |
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index 908a7ee55..1dacb3783 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c | |||
@@ -459,7 +459,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
459 | "%s", "Could not initialize plugin, assuming database not configured. Test not run!\n"); | 459 | "%s", "Could not initialize plugin, assuming database not configured. Test not run!\n"); |
460 | return; | 460 | return; |
461 | } | 461 | } |
462 | crc = GNUNET_malloc (sizeof (struct CpsRunContext)); | 462 | crc = GNUNET_new (struct CpsRunContext); |
463 | crc->api = api; | 463 | crc->api = api; |
464 | crc->cfg = c; | 464 | crc->cfg = c; |
465 | crc->phase = RP_PUT; | 465 | crc->phase = RP_PUT; |
diff --git a/src/datastore/plugin_datastore_heap.c b/src/datastore/plugin_datastore_heap.c index 1f756a95c..8f7f3d1de 100644 --- a/src/datastore/plugin_datastore_heap.c +++ b/src/datastore/plugin_datastore_heap.c | |||
@@ -240,7 +240,7 @@ heap_plugin_put (void *cls, | |||
240 | break; | 240 | break; |
241 | if (NULL == zabt) | 241 | if (NULL == zabt) |
242 | { | 242 | { |
243 | zabt = GNUNET_malloc (sizeof (struct ZeroAnonByType)); | 243 | zabt = GNUNET_new (struct ZeroAnonByType); |
244 | zabt->type = type; | 244 | zabt->type = type; |
245 | GNUNET_CONTAINER_DLL_insert (plugin->zero_head, | 245 | GNUNET_CONTAINER_DLL_insert (plugin->zero_head, |
246 | plugin->zero_tail, | 246 | plugin->zero_tail, |
@@ -800,12 +800,12 @@ libgnunet_plugin_datastore_heap_init (void *cls) | |||
800 | "HASHMAPSIZE", | 800 | "HASHMAPSIZE", |
801 | &esize)) | 801 | &esize)) |
802 | esize = 128 * 1024; | 802 | esize = 128 * 1024; |
803 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | 803 | plugin = GNUNET_new (struct Plugin); |
804 | plugin->env = env; | 804 | plugin->env = env; |
805 | plugin->keyvalue = GNUNET_CONTAINER_multihashmap_create (esize, GNUNET_YES); | 805 | plugin->keyvalue = GNUNET_CONTAINER_multihashmap_create (esize, GNUNET_YES); |
806 | plugin->by_expiration = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 806 | plugin->by_expiration = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
807 | plugin->by_replication = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX); | 807 | plugin->by_replication = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX); |
808 | api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions)); | 808 | api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions); |
809 | api->cls = plugin; | 809 | api->cls = plugin; |
810 | api->estimate_size = &heap_plugin_estimate_size; | 810 | api->estimate_size = &heap_plugin_estimate_size; |
811 | api->put = &heap_plugin_put; | 811 | api->put = &heap_plugin_put; |
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index cf0172583..fab10b206 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c | |||
@@ -946,7 +946,7 @@ libgnunet_plugin_datastore_mysql_init (void *cls) | |||
946 | struct GNUNET_DATASTORE_PluginFunctions *api; | 946 | struct GNUNET_DATASTORE_PluginFunctions *api; |
947 | struct Plugin *plugin; | 947 | struct Plugin *plugin; |
948 | 948 | ||
949 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | 949 | plugin = GNUNET_new (struct Plugin); |
950 | plugin->env = env; | 950 | plugin->env = env; |
951 | plugin->mc = GNUNET_MYSQL_context_create (env->cfg, "datastore-mysql"); | 951 | plugin->mc = GNUNET_MYSQL_context_create (env->cfg, "datastore-mysql"); |
952 | if (NULL == plugin->mc) | 952 | if (NULL == plugin->mc) |
@@ -1007,7 +1007,7 @@ libgnunet_plugin_datastore_mysql_init (void *cls) | |||
1007 | #undef PINIT | 1007 | #undef PINIT |
1008 | #undef MRUNS | 1008 | #undef MRUNS |
1009 | 1009 | ||
1010 | api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions)); | 1010 | api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions); |
1011 | api->cls = plugin; | 1011 | api->cls = plugin; |
1012 | api->estimate_size = &mysql_plugin_estimate_size; | 1012 | api->estimate_size = &mysql_plugin_estimate_size; |
1013 | api->put = &mysql_plugin_put; | 1013 | api->put = &mysql_plugin_put; |
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index 6a96ad5d3..79217c998 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c | |||
@@ -838,14 +838,14 @@ libgnunet_plugin_datastore_postgres_init (void *cls) | |||
838 | struct GNUNET_DATASTORE_PluginFunctions *api; | 838 | struct GNUNET_DATASTORE_PluginFunctions *api; |
839 | struct Plugin *plugin; | 839 | struct Plugin *plugin; |
840 | 840 | ||
841 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | 841 | plugin = GNUNET_new (struct Plugin); |
842 | plugin->env = env; | 842 | plugin->env = env; |
843 | if (GNUNET_OK != init_connection (plugin)) | 843 | if (GNUNET_OK != init_connection (plugin)) |
844 | { | 844 | { |
845 | GNUNET_free (plugin); | 845 | GNUNET_free (plugin); |
846 | return NULL; | 846 | return NULL; |
847 | } | 847 | } |
848 | api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions)); | 848 | api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions); |
849 | api->cls = plugin; | 849 | api->cls = plugin; |
850 | api->estimate_size = &postgres_plugin_estimate_size; | 850 | api->estimate_size = &postgres_plugin_estimate_size; |
851 | api->put = &postgres_plugin_put; | 851 | api->put = &postgres_plugin_put; |
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index bd344dbb1..f2e0454f9 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -1179,7 +1179,7 @@ libgnunet_plugin_datastore_sqlite_init (void *cls) | |||
1179 | database_shutdown (&plugin); | 1179 | database_shutdown (&plugin); |
1180 | return NULL; | 1180 | return NULL; |
1181 | } | 1181 | } |
1182 | api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions)); | 1182 | api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions); |
1183 | api->cls = &plugin; | 1183 | api->cls = &plugin; |
1184 | api->estimate_size = &sqlite_plugin_estimate_size; | 1184 | api->estimate_size = &sqlite_plugin_estimate_size; |
1185 | api->put = &sqlite_plugin_put; | 1185 | api->put = &sqlite_plugin_put; |
diff --git a/src/datastore/plugin_datastore_template.c b/src/datastore/plugin_datastore_template.c index 2978de4fe..5e577b1bc 100644 --- a/src/datastore/plugin_datastore_template.c +++ b/src/datastore/plugin_datastore_template.c | |||
@@ -240,9 +240,9 @@ libgnunet_plugin_datastore_template_init (void *cls) | |||
240 | struct GNUNET_DATASTORE_PluginFunctions *api; | 240 | struct GNUNET_DATASTORE_PluginFunctions *api; |
241 | struct Plugin *plugin; | 241 | struct Plugin *plugin; |
242 | 242 | ||
243 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | 243 | plugin = GNUNET_new (struct Plugin); |
244 | plugin->env = env; | 244 | plugin->env = env; |
245 | api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions)); | 245 | api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions); |
246 | api->cls = plugin; | 246 | api->cls = plugin; |
247 | api->estimate_size = &template_plugin_estimate_size; | 247 | api->estimate_size = &template_plugin_estimate_size; |
248 | api->put = &template_plugin_put; | 248 | api->put = &template_plugin_put; |
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index 03939cee3..26d0f1343 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c | |||
@@ -471,7 +471,7 @@ run (void *cls, | |||
471 | struct CpsRunContext *crc; | 471 | struct CpsRunContext *crc; |
472 | static struct GNUNET_HashCode zkey; | 472 | static struct GNUNET_HashCode zkey; |
473 | 473 | ||
474 | crc = GNUNET_malloc (sizeof (struct CpsRunContext)); | 474 | crc = GNUNET_new (struct CpsRunContext); |
475 | crc->cfg = cfg; | 475 | crc->cfg = cfg; |
476 | crc->phase = RP_PUT; | 476 | crc->phase = RP_PUT; |
477 | now = GNUNET_TIME_absolute_get (); | 477 | now = GNUNET_TIME_absolute_get (); |
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c index 7f330031a..5553e5c0b 100644 --- a/src/datastore/test_datastore_api_management.c +++ b/src/datastore/test_datastore_api_management.c | |||
@@ -265,7 +265,7 @@ run (void *cls, | |||
265 | struct CpsRunContext *crc; | 265 | struct CpsRunContext *crc; |
266 | static struct GNUNET_HashCode zkey; | 266 | static struct GNUNET_HashCode zkey; |
267 | 267 | ||
268 | crc = GNUNET_malloc (sizeof (struct CpsRunContext)); | 268 | crc = GNUNET_new (struct CpsRunContext); |
269 | crc->cfg = cfg; | 269 | crc->cfg = cfg; |
270 | crc->phase = RP_PUT; | 270 | crc->phase = RP_PUT; |
271 | now = GNUNET_TIME_absolute_get (); | 271 | now = GNUNET_TIME_absolute_get (); |
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c index 844d32a7b..4eefcaefa 100644 --- a/src/datastore/test_plugin_datastore.c +++ b/src/datastore/test_plugin_datastore.c | |||
@@ -345,7 +345,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
345 | "%s", "Could not initialize plugin, assuming database not configured. Test not run!\n"); | 345 | "%s", "Could not initialize plugin, assuming database not configured. Test not run!\n"); |
346 | return; | 346 | return; |
347 | } | 347 | } |
348 | crc = GNUNET_malloc (sizeof (struct CpsRunContext)); | 348 | crc = GNUNET_new (struct CpsRunContext); |
349 | crc->api = api; | 349 | crc->api = api; |
350 | crc->cfg = c; | 350 | crc->cfg = c; |
351 | crc->phase = RP_PUT; | 351 | crc->phase = RP_PUT; |