aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-12-19 06:00:23 +0000
committerLRN <lrn1986@gmail.com>2013-12-19 06:00:23 +0000
commite0ca7357cd0bfedc5c29cb731b56279fef8da059 (patch)
treeecfd47cf59bc00e656b53fd59c58f5038e342d65 /src/datastore
parent92fd84dc7ef98452f848a62677c61a2b80b5835e (diff)
malloc -> new
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/gnunet-service-datastore.c8
-rw-r--r--src/datastore/perf_datastore_api.c2
-rw-r--r--src/datastore/perf_plugin_datastore.c2
-rw-r--r--src/datastore/plugin_datastore_heap.c6
-rw-r--r--src/datastore/plugin_datastore_mysql.c4
-rw-r--r--src/datastore/plugin_datastore_postgres.c4
-rw-r--r--src/datastore/plugin_datastore_sqlite.c2
-rw-r--r--src/datastore/plugin_datastore_template.c4
-rw-r--r--src/datastore/test_datastore_api.c2
-rw-r--r--src/datastore/test_datastore_api_management.c2
-rw-r--r--src/datastore/test_plugin_datastore.c2
11 files changed, 19 insertions, 19 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index 7c4c47e901..98ef6d797e 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)
GNUNET_free (msg);
return;
}
- tcc = GNUNET_malloc (sizeof (struct TransmitCallbackContext));
+ tcc = GNUNET_new (struct TransmitCallbackContext);
tcc->msg = msg;
tcc->client = client;
if (NULL ==
@@ -598,7 +598,7 @@ transmit_item (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
/* transmit 'DATA_END' */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' message\n",
"DATA_END");
- end = GNUNET_malloc (sizeof (struct GNUNET_MessageHeader));
+ end = GNUNET_new (struct GNUNET_MessageHeader);
end->size = htons (sizeof (struct GNUNET_MessageHeader));
end->type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END);
transmit (client, end);
@@ -698,7 +698,7 @@ handle_reserve (void *cls, struct GNUNET_SERVER_Client *client,
reserved += req;
GNUNET_STATISTICS_set (stats, gettext_noop ("# reserved"), reserved,
GNUNET_NO);
- e = GNUNET_malloc (sizeof (struct ReservationList));
+ e = GNUNET_new (struct ReservationList);
e->next = reservations;
reservations = e;
e->client = client;
@@ -1274,7 +1274,7 @@ load_plugin ()
struct DatastorePlugin *ret;
char *libname;
- ret = GNUNET_malloc (sizeof (struct DatastorePlugin));
+ ret = GNUNET_new (struct DatastorePlugin);
ret->env.cfg = cfg;
ret->env.duc = &disk_utilization_change_cb;
ret->env.cls = NULL;
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index c51502cc65..90f72d6eec 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -303,7 +303,7 @@ run (void *cls,
datastore = GNUNET_DATASTORE_connect (cfg);
start_time = GNUNET_TIME_absolute_get ();
- crc = GNUNET_malloc (sizeof (struct CpsRunContext));
+ crc = GNUNET_new (struct CpsRunContext);
crc->cfg = cfg;
crc->phase = RP_PUT;
if (NULL ==
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index 908a7ee556..1dacb37838 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,
"%s", "Could not initialize plugin, assuming database not configured. Test not run!\n");
return;
}
- crc = GNUNET_malloc (sizeof (struct CpsRunContext));
+ crc = GNUNET_new (struct CpsRunContext);
crc->api = api;
crc->cfg = c;
crc->phase = RP_PUT;
diff --git a/src/datastore/plugin_datastore_heap.c b/src/datastore/plugin_datastore_heap.c
index 1f756a95c9..8f7f3d1dec 100644
--- a/src/datastore/plugin_datastore_heap.c
+++ b/src/datastore/plugin_datastore_heap.c
@@ -240,7 +240,7 @@ heap_plugin_put (void *cls,
break;
if (NULL == zabt)
{
- zabt = GNUNET_malloc (sizeof (struct ZeroAnonByType));
+ zabt = GNUNET_new (struct ZeroAnonByType);
zabt->type = type;
GNUNET_CONTAINER_DLL_insert (plugin->zero_head,
plugin->zero_tail,
@@ -800,12 +800,12 @@ libgnunet_plugin_datastore_heap_init (void *cls)
"HASHMAPSIZE",
&esize))
esize = 128 * 1024;
- plugin = GNUNET_malloc (sizeof (struct Plugin));
+ plugin = GNUNET_new (struct Plugin);
plugin->env = env;
plugin->keyvalue = GNUNET_CONTAINER_multihashmap_create (esize, GNUNET_YES);
plugin->by_expiration = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
plugin->by_replication = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX);
- api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions);
api->cls = plugin;
api->estimate_size = &heap_plugin_estimate_size;
api->put = &heap_plugin_put;
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c
index cf01725832..fab10b2062 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)
struct GNUNET_DATASTORE_PluginFunctions *api;
struct Plugin *plugin;
- plugin = GNUNET_malloc (sizeof (struct Plugin));
+ plugin = GNUNET_new (struct Plugin);
plugin->env = env;
plugin->mc = GNUNET_MYSQL_context_create (env->cfg, "datastore-mysql");
if (NULL == plugin->mc)
@@ -1007,7 +1007,7 @@ libgnunet_plugin_datastore_mysql_init (void *cls)
#undef PINIT
#undef MRUNS
- api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions);
api->cls = plugin;
api->estimate_size = &mysql_plugin_estimate_size;
api->put = &mysql_plugin_put;
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index 6a96ad5d37..79217c9989 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)
struct GNUNET_DATASTORE_PluginFunctions *api;
struct Plugin *plugin;
- plugin = GNUNET_malloc (sizeof (struct Plugin));
+ plugin = GNUNET_new (struct Plugin);
plugin->env = env;
if (GNUNET_OK != init_connection (plugin))
{
GNUNET_free (plugin);
return NULL;
}
- api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions);
api->cls = plugin;
api->estimate_size = &postgres_plugin_estimate_size;
api->put = &postgres_plugin_put;
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c
index bd344dbb19..f2e0454f92 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)
database_shutdown (&plugin);
return NULL;
}
- api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions);
api->cls = &plugin;
api->estimate_size = &sqlite_plugin_estimate_size;
api->put = &sqlite_plugin_put;
diff --git a/src/datastore/plugin_datastore_template.c b/src/datastore/plugin_datastore_template.c
index 2978de4feb..5e577b1bc3 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)
struct GNUNET_DATASTORE_PluginFunctions *api;
struct Plugin *plugin;
- plugin = GNUNET_malloc (sizeof (struct Plugin));
+ plugin = GNUNET_new (struct Plugin);
plugin->env = env;
- api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_DATASTORE_PluginFunctions);
api->cls = plugin;
api->estimate_size = &template_plugin_estimate_size;
api->put = &template_plugin_put;
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index 03939cee34..26d0f13438 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -471,7 +471,7 @@ run (void *cls,
struct CpsRunContext *crc;
static struct GNUNET_HashCode zkey;
- crc = GNUNET_malloc (sizeof (struct CpsRunContext));
+ crc = GNUNET_new (struct CpsRunContext);
crc->cfg = cfg;
crc->phase = RP_PUT;
now = GNUNET_TIME_absolute_get ();
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c
index 7f330031a7..5553e5c0be 100644
--- a/src/datastore/test_datastore_api_management.c
+++ b/src/datastore/test_datastore_api_management.c
@@ -265,7 +265,7 @@ run (void *cls,
struct CpsRunContext *crc;
static struct GNUNET_HashCode zkey;
- crc = GNUNET_malloc (sizeof (struct CpsRunContext));
+ crc = GNUNET_new (struct CpsRunContext);
crc->cfg = cfg;
crc->phase = RP_PUT;
now = GNUNET_TIME_absolute_get ();
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c
index 844d32a7be..4eefcaefa7 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,
"%s", "Could not initialize plugin, assuming database not configured. Test not run!\n");
return;
}
- crc = GNUNET_malloc (sizeof (struct CpsRunContext));
+ crc = GNUNET_new (struct CpsRunContext);
crc->api = api;
crc->cfg = c;
crc->phase = RP_PUT;