summaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-helper-testbed.c2
-rw-r--r--src/testbed/gnunet-service-testbed-logger.c2
-rw-r--r--src/testbed/gnunet-service-testbed.c6
-rw-r--r--src/testbed/gnunet-service-testbed_barriers.c8
-rw-r--r--src/testbed/gnunet-service-testbed_cache.c2
-rw-r--r--src/testbed/gnunet-service-testbed_links.c18
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c14
-rw-r--r--src/testbed/testbed_api.c28
-rw-r--r--src/testbed/testbed_api_barriers.c4
-rw-r--r--src/testbed/testbed_api_hosts.c10
-rw-r--r--src/testbed/testbed_api_operations.c10
-rw-r--r--src/testbed/testbed_api_peers.c40
-rw-r--r--src/testbed/testbed_api_sd.c4
-rw-r--r--src/testbed/testbed_api_services.c2
-rw-r--r--src/testbed/testbed_api_statistics.c4
-rw-r--r--src/testbed/testbed_api_testbed.c10
-rw-r--r--src/testbed/testbed_api_topology.c4
-rw-r--r--src/testbed/testbed_logger_api.c4
18 files changed, 86 insertions, 86 deletions
diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c
index 4c68b2cd4..e8c70a354 100644
--- a/src/testbed/gnunet-helper-testbed.c
+++ b/src/testbed/gnunet-helper-testbed.c
@@ -480,7 +480,7 @@ tokenizer_cb (void *cls, void *client,
xconfig_size =
GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
GNUNET_free (config);
- wc = GNUNET_malloc (sizeof (struct WriteContext));
+ wc = GNUNET_new (struct WriteContext);
wc->length = xconfig_size + sizeof (struct GNUNET_TESTBED_HelperReply);
reply = GNUNET_realloc (xconfig, wc->length);
memmove (&reply[1], reply, xconfig_size);
diff --git a/src/testbed/gnunet-service-testbed-logger.c b/src/testbed/gnunet-service-testbed-logger.c
index dfa9da52f..8129c7cbf 100644
--- a/src/testbed/gnunet-service-testbed-logger.c
+++ b/src/testbed/gnunet-service-testbed-logger.c
@@ -145,7 +145,7 @@ queue_message (struct GNUNET_SERVER_Client *client,
type = ntohs (msg->type);
size = ntohs (msg->size);
- mq_entry = GNUNET_malloc (sizeof (struct MessageQueue));
+ mq_entry = GNUNET_new (struct MessageQueue);
mq_entry->msg = msg;
mq_entry->client = client;
GNUNET_SERVER_client_keep (client);
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index 6f806e21b..a1d6aed09 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -191,7 +191,7 @@ GST_queue_message (struct GNUNET_SERVER_Client *client,
size = ntohs (msg->size);
GNUNET_assert ((GNUNET_MESSAGE_TYPE_TESTBED_INIT <= type) &&
(GNUNET_MESSAGE_TYPE_TESTBED_MAX > type));
- mq_entry = GNUNET_malloc (sizeof (struct MessageQueue));
+ mq_entry = GNUNET_new (struct MessageQueue);
mq_entry->msg = msg;
mq_entry->client = client;
GNUNET_SERVER_client_keep (client);
@@ -364,7 +364,7 @@ GST_queue_host_registration (struct Slave *slave,
"Queueing host registration for host %u at %u\n",
GNUNET_TESTBED_host_get_id_ (host),
GNUNET_TESTBED_host_get_id_ (GST_host_list[slave->host_id]));
- hr = GNUNET_malloc (sizeof (struct HostRegistration));
+ hr = GNUNET_new (struct HostRegistration);
hr->cb = cb;
hr->cb_cls = cb_cls;
hr->host = host;
@@ -525,7 +525,7 @@ handle_init (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_free (ss_str);
ss_str = NULL;
}
- GST_context = GNUNET_malloc (sizeof (struct Context));
+ GST_context = GNUNET_new (struct Context);
GNUNET_SERVER_client_keep (client);
GST_context->client = client;
GST_context->host_id = ntohl (msg->host_id);
diff --git a/src/testbed/gnunet-service-testbed_barriers.c b/src/testbed/gnunet-service-testbed_barriers.c
index 482d0ddcd..de2c175f1 100644
--- a/src/testbed/gnunet-service-testbed_barriers.c
+++ b/src/testbed/gnunet-service-testbed_barriers.c
@@ -306,7 +306,7 @@ queue_message (struct ClientCtx *ctx, struct GNUNET_MessageHeader *msg)
struct MessageQueue *mq;
struct GNUNET_SERVER_Client *client = ctx->client;
- mq = GNUNET_malloc (sizeof (struct MessageQueue));
+ mq = GNUNET_new (struct MessageQueue);
mq->msg = msg;
LOG_DEBUG ("Queueing message of type %u, size %u for sending\n",
ntohs (msg->type), ntohs (msg->size));
@@ -494,7 +494,7 @@ handle_barrier_wait (void *cls, struct GNUNET_SERVER_Client *client,
client_ctx = GNUNET_SERVER_client_get_user_context (client, struct ClientCtx);
if (NULL == client_ctx)
{
- client_ctx = GNUNET_malloc (sizeof (struct ClientCtx));
+ client_ctx = GNUNET_new (struct ClientCtx);
client_ctx->client = client;
GNUNET_SERVER_client_keep (client);
client_ctx->barrier = barrier;
@@ -747,7 +747,7 @@ GST_handle_barrier_init (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
- barrier = GNUNET_malloc (sizeof (struct Barrier));
+ barrier = GNUNET_new (struct Barrier);
(void) memcpy (&barrier->hash, &hash, sizeof (struct GNUNET_HashCode));
barrier->quorum = msg->quorum;
barrier->name = name;
@@ -769,7 +769,7 @@ GST_handle_barrier_init (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_break (0);/* May happen when we are connecting to the controller */
continue;
}
- wrapper = GNUNET_malloc (sizeof (struct WBarrier));
+ wrapper = GNUNET_new (struct WBarrier);
wrapper->barrier = barrier;
GNUNET_CONTAINER_DLL_insert_tail (barrier->whead, barrier->wtail, wrapper);
wrapper->hbarrier = GNUNET_TESTBED_barrier_init_ (slave->controller,
diff --git a/src/testbed/gnunet-service-testbed_cache.c b/src/testbed/gnunet-service-testbed_cache.c
index 50ffe7679..7f2a35a7d 100644
--- a/src/testbed/gnunet-service-testbed_cache.c
+++ b/src/testbed/gnunet-service-testbed_cache.c
@@ -132,7 +132,7 @@ add_entry (unsigned int peer_id)
entry->peer_id,
entry));
}
- entry = GNUNET_malloc (sizeof (struct CacheEntry));
+ entry = GNUNET_new (struct CacheEntry);
entry->peer_id = peer_id;
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap32_put (cache,
diff --git a/src/testbed/gnunet-service-testbed_links.c b/src/testbed/gnunet-service-testbed_links.c
index 766c47471..cb908f12b 100644
--- a/src/testbed/gnunet-service-testbed_links.c
+++ b/src/testbed/gnunet-service-testbed_links.c
@@ -970,7 +970,7 @@ GST_neighbour_get_connection (struct Neighbour *n,
GNUNET_assert (NULL != cb);
LOG_DEBUG ("Attempting to get connection to controller on host %u\n",
n->host_id);
- h = GNUNET_malloc (sizeof (struct NeighbourConnectNotification));
+ h = GNUNET_new (struct NeighbourConnectNotification);
h->n = n;
h->cb = cb;
h->cb_cls = cb_cls;
@@ -1163,7 +1163,7 @@ GST_create_neighbour (struct GNUNET_TESTBED_Host *host)
{
struct Neighbour *n;
- n = GNUNET_malloc (sizeof (struct Neighbour));
+ n = GNUNET_new (struct Neighbour);
n->host_id = GNUNET_TESTBED_host_get_id_ (host);
neighbour_list_add (n); /* just add; connect on-demand */
return n;
@@ -1249,7 +1249,7 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
LOG_DEBUG ("Received request to establish a link to host %u\n",
delegated_host_id);
n = GST_create_neighbour (GST_host_list[delegated_host_id]);
- ncc = GNUNET_malloc (sizeof (struct NeighbourConnectCtxt));
+ ncc = GNUNET_new (struct NeighbourConnectCtxt);
ncc->n = n;
ncc->op_id = op_id;
ncc->client = client;
@@ -1271,11 +1271,11 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
}
LOG_DEBUG ("Received request to start and establish a link to host %u\n",
delegated_host_id);
- slave = GNUNET_malloc (sizeof (struct Slave));
+ slave = GNUNET_new (struct Slave);
slave->host_id = delegated_host_id;
slave->reghost_map = GNUNET_CONTAINER_multihashmap_create (100, GNUNET_NO);
slave_list_add (slave);
- lcc = GNUNET_malloc (sizeof (struct LinkControllersContext));
+ lcc = GNUNET_new (struct LinkControllersContext);
lcc->operation_id = op_id;
GNUNET_SERVER_client_keep (client);
lcc->client = client;
@@ -1284,7 +1284,7 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_TESTBED_controller_start (GST_context->master_ip,
GST_host_list[slave->host_id],
&slave_status_cb, slave);
- new_route = GNUNET_malloc (sizeof (struct Route));
+ new_route = GNUNET_new (struct Route);
new_route->dest = delegated_host_id;
new_route->thru = GST_context->host_id;
route_list_add (new_route);
@@ -1298,8 +1298,8 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- lcfq = GNUNET_malloc (sizeof (struct LCFContextQueue));
- lcfq->lcf = GNUNET_malloc (sizeof (struct LCFContext));
+ lcfq = GNUNET_new (struct LCFContextQueue);
+ lcfq->lcf = GNUNET_new (struct LCFContext);
lcfq->lcf->delegated_host_id = delegated_host_id;
lcfq->lcf->slave_host_id = slave_host_id;
route = GST_find_dest_route (slave_host_id);
@@ -1335,7 +1335,7 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- new_route = GNUNET_malloc (sizeof (struct Route));
+ new_route = GNUNET_new (struct Route);
new_route->dest = delegated_host_id;
new_route->thru = route->dest;
route_list_add (new_route);
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c
index 5ea6e48e1..c2978728c 100644
--- a/src/testbed/gnunet-service-testbed_oc.c
+++ b/src/testbed/gnunet-service-testbed_oc.c
@@ -444,7 +444,7 @@ GST_process_next_focc (struct RegisteredHostContext *rhc)
peer = GST_peer_list[focc->peer1];
GNUNET_assert (GNUNET_YES == peer->is_remote);
GNUNET_assert (NULL != (slave = peer->details.remote.slave));
- fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
+ fopc = GNUNET_new (struct ForwardedOperationContext);
GNUNET_SERVER_client_keep (focc->client);
fopc->client = focc->client;
fopc->operation_id = focc->operation_id;
@@ -605,7 +605,7 @@ send_overlay_connect_success_msg (struct OverlayConnectContext *occ)
LOG_DEBUG ("0x%llx: Peers connected - Sending overlay connect success\n",
occ->op_id);
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ConnectionEventMessage));
+ msg = GNUNET_new (struct GNUNET_TESTBED_ConnectionEventMessage);
msg->header.size =
htons (sizeof (struct GNUNET_TESTBED_ConnectionEventMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT);
@@ -1223,7 +1223,7 @@ register_host (struct Slave *slave, struct GNUNET_TESTBED_Host *host)
struct GNUNET_HashCode hash;
struct RegisteredHostContext *rhc;
- rhc = GNUNET_malloc (sizeof (struct RegisteredHostContext));
+ rhc = GNUNET_new (struct RegisteredHostContext);
rhc->reg_host = host;
rhc->host = GST_host_list[slave->host_id];
GNUNET_assert (NULL != rhc->reg_host);
@@ -1304,7 +1304,7 @@ forward_overlay_connect (const struct GNUNET_TESTBED_OverlayConnectMessage *msg,
GST_host_list[peer2_host_id])))
{
LOG_DEBUG ("Queueing forwarding FOCC for connecting peers %u and %u\n", p1, p2);
- focc = GNUNET_malloc (sizeof (struct ForwardedOverlayConnectContext));
+ focc = GNUNET_new (struct ForwardedOverlayConnectContext);
focc->peer1 = p1;
focc->peer2 = p2;
focc->peer2_host_id = peer2_host_id;
@@ -1319,7 +1319,7 @@ forward_overlay_connect (const struct GNUNET_TESTBED_OverlayConnectMessage *msg,
forward:
LOG_DEBUG ("Forwarding without FOCC for connecting peers %u and %u\n", p1, p2);
- fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
+ fopc = GNUNET_new (struct ForwardedOperationContext);
GNUNET_SERVER_client_keep (client);
fopc->client = client;
fopc->operation_id = op_id;
@@ -1429,7 +1429,7 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
return;
}
p2n = NULL;
- occ = GNUNET_malloc (sizeof (struct OverlayConnectContext));
+ occ = GNUNET_new (struct OverlayConnectContext);
occ->type = OCC_TYPE_LOCAL;
if (!VALID_PEER_ID (p2)) /* May be peer2 is on a another controller */
{
@@ -1743,7 +1743,7 @@ GST_handle_remote_overlay_connect (void *cls,
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
- rocc = GNUNET_malloc (sizeof (struct RemoteOverlayConnectCtx));
+ rocc = GNUNET_new (struct RemoteOverlayConnectCtx);
rocc->op_id = GNUNET_ntohll (msg->operation_id);
GNUNET_CONTAINER_DLL_insert_tail (roccq_head, roccq_tail, rocc);
memcpy (&rocc->a_id, &msg->peer_identity,
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 2ee17c9e0..a65102ead 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -200,7 +200,7 @@ exop_insert (struct GNUNET_TESTBED_Operation *op)
{
struct ExpireOperationEntry *entry;
- entry = GNUNET_malloc (sizeof (struct ExpireOperationEntry));
+ entry = GNUNET_new (struct ExpireOperationEntry);
entry->op = op;
GNUNET_CONTAINER_DLL_insert_tail (exop_head, exop_tail, entry);
}
@@ -737,7 +737,7 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
peer = data->peer;
GNUNET_assert (NULL != peer);
GNUNET_assert (ntohl (msg->peer_id) == peer->unique_id);
- pinfo = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerInformation));
+ pinfo = GNUNET_new (struct GNUNET_TESTBED_PeerInformation);
pinfo->pit = data->pit;
cb = data->cb;
cb_cls = data->cb_cls;
@@ -747,7 +747,7 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
switch (pinfo->pit)
{
case GNUNET_TESTBED_PIT_IDENTITY:
- pinfo->result.id = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
+ pinfo->result.id = GNUNET_new (struct GNUNET_PeerIdentity);
(void) memcpy (pinfo->result.id, &msg->peer_identity,
sizeof (struct GNUNET_PeerIdentity));
break;
@@ -1253,7 +1253,7 @@ GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller,
size = ntohs (msg->size);
GNUNET_assert ((GNUNET_MESSAGE_TYPE_TESTBED_INIT <= type) &&
(GNUNET_MESSAGE_TYPE_TESTBED_MAX > type));
- mq_entry = GNUNET_malloc (sizeof (struct MessageQueue));
+ mq_entry = GNUNET_new (struct MessageQueue);
mq_entry->msg = msg;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Queueing message of type %u, size %u for sending\n", type,
@@ -1295,10 +1295,10 @@ GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller
struct GNUNET_MessageHeader *dup_msg;
uint16_t msize;
- data = GNUNET_malloc (sizeof (struct ForwardedOperationData));
+ data = GNUNET_new (struct ForwardedOperationData);
data->cc = cc;
data->cc_cls = cc_cls;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = controller;
opc->type = OP_FORWARDED;
opc->data = data;
@@ -1482,7 +1482,7 @@ GNUNET_TESTBED_controller_connect (struct GNUNET_TESTBED_Host *host,
GNUNET_break (0);
return NULL;
}
- controller = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Controller));
+ controller = GNUNET_new (struct GNUNET_TESTBED_Controller);
controller->cc = cc;
controller->cc_cls = cc_cls;
controller->event_mask = event_mask;
@@ -1706,10 +1706,10 @@ GNUNET_TESTBED_controller_link (void *op_cls,
msg->delegated_host_id = htonl (delegated_host_id);
msg->slave_host_id = htonl (slave_host_id);
msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;
- data = GNUNET_malloc (sizeof (struct ControllerLinkData));
+ data = GNUNET_new (struct ControllerLinkData);
data->msg = msg;
data->host_id = delegated_host_id;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = master;
opc->data = data;
opc->type = OP_LINK_CONTROLLERS;
@@ -1747,9 +1747,9 @@ GNUNET_TESTBED_get_slave_config_ (void *op_cls,
struct OperationContext *opc;
struct GetSlaveConfigData *data;
- data = GNUNET_malloc (sizeof (struct GetSlaveConfigData));
+ data = GNUNET_new (struct GetSlaveConfigData);
data->slave_id = slave_host_id;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->state = OPC_STATE_INIT;
opc->c = master;
opc->id = GNUNET_TESTBED_get_next_op_id (master);
@@ -2076,7 +2076,7 @@ opstart_shutdown_peers (void *cls)
struct GNUNET_TESTBED_ShutdownPeersMessage *msg;
opc->state = OPC_STATE_STARTED;
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage));
+ msg = GNUNET_new (struct GNUNET_TESTBED_ShutdownPeersMessage);
msg->header.size =
htons (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS);
@@ -2137,10 +2137,10 @@ GNUNET_TESTBED_shutdown_peers (struct GNUNET_TESTBED_Controller *c,
if (0 != GNUNET_CONTAINER_multihashmap32_size (c->opc_map))
return NULL;
- data = GNUNET_malloc (sizeof (struct ShutdownPeersData));
+ data = GNUNET_new (struct ShutdownPeersData);
data->cb = cb;
data->cb_cls = cb_cls;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = c;
opc->op_cls = op_cls;
opc->data = data;
diff --git a/src/testbed/testbed_api_barriers.c b/src/testbed/testbed_api_barriers.c
index 2ec34bb1b..e407b173e 100644
--- a/src/testbed/testbed_api_barriers.c
+++ b/src/testbed/testbed_api_barriers.c
@@ -234,7 +234,7 @@ GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller,
return NULL;
}
LOG_DEBUG ("Initialising barrier `%s'\n", name);
- barrier = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Barrier));
+ barrier = GNUNET_new (struct GNUNET_TESTBED_Barrier);
barrier->c = controller;
barrier->name = GNUNET_strdup (name);
barrier->cb = cb;
@@ -488,7 +488,7 @@ GNUNET_TESTBED_barrier_wait (const char *name,
GNUNET_CONFIGURATION_destroy (cfg);
return NULL;
}
- h = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_BarrierWaitHandle));
+ h = GNUNET_new (struct GNUNET_TESTBED_BarrierWaitHandle);
h->name = GNUNET_strdup (name);
h->cfg = cfg;
h->conn = GNUNET_CLIENT_connect ("testbed-barrier", h->cfg);
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index 8af8e23d0..5a5b00e5a 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -331,7 +331,7 @@ GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname,
LOG (GNUNET_ERROR_TYPE_WARNING, "Host with id: %u already created\n", id);
return NULL;
}
- host = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host));
+ host = GNUNET_new (struct GNUNET_TESTBED_Host);
host->hostname = (NULL != hostname) ? GNUNET_strdup (hostname) : NULL;
host->username = (NULL != username) ? GNUNET_strdup (username) : NULL;
host->id = id;
@@ -649,7 +649,7 @@ GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host,
return;
}
}
- rc = GNUNET_malloc (sizeof (struct RegisteredController));
+ rc = GNUNET_new (struct RegisteredController);
rc->controller = controller;
GNUNET_CONTAINER_DLL_insert_tail (host->rc_head, host->rc_tail, rc);
}
@@ -1079,7 +1079,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip,
host->locked = GNUNET_YES;
API_VIOLATION (GNUNET_NO == host->controller_started,
"Attempting to start a controller on a host which is already started a controller");
- cp = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ControllerProc));
+ cp = GNUNET_new (struct GNUNET_TESTBED_ControllerProc);
if (0 == GNUNET_TESTBED_host_get_id_ (host))
{
cp->helper =
@@ -1324,7 +1324,7 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
const char *hostname;
char *port;
- h = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostHabitableCheckHandle));
+ h = GNUNET_new (struct GNUNET_TESTBED_HostHabitableCheckHandle);
h->cb = cb;
h->cb_cls = cb_cls;
h->host = host;
@@ -1449,7 +1449,7 @@ GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller,
(NULL == hostname) ? "localhost" : hostname);
return NULL;
}
- rh = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostRegistrationHandle));
+ rh = GNUNET_new (struct GNUNET_TESTBED_HostRegistrationHandle);
rh->host = host;
rh->c = controller;
GNUNET_assert (NULL != cc);
diff --git a/src/testbed/testbed_api_operations.c b/src/testbed/testbed_api_operations.c
index ce2ef5715..2a559a90e 100644
--- a/src/testbed/testbed_api_operations.c
+++ b/src/testbed/testbed_api_operations.c
@@ -455,7 +455,7 @@ change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state)
{
if (OP_STATE_INIT == op->state)
{
- entry = GNUNET_malloc (sizeof (struct QueueEntry));
+ entry = GNUNET_new (struct QueueEntry);
entry->op = op;
entry->nres = op->nres[cnt];
s = cnt;
@@ -557,7 +557,7 @@ rq_add (struct GNUNET_TESTBED_Operation *op)
struct ReadyQueueEntry *rq_entry;
GNUNET_assert (NULL == op->rq_entry);
- rq_entry = GNUNET_malloc (sizeof (struct ReadyQueueEntry));
+ rq_entry = GNUNET_new (struct ReadyQueueEntry);
rq_entry->op = op;
GNUNET_CONTAINER_DLL_insert_tail (rq_head, rq_tail, rq_entry);
op->rq_entry = rq_entry;
@@ -970,7 +970,7 @@ GNUNET_TESTBED_operation_create_ (void *cls, OperationStart start,
{
struct GNUNET_TESTBED_Operation *op;
- op = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Operation));
+ op = GNUNET_new (struct GNUNET_TESTBED_Operation);
op->start = start;
op->state = OP_STATE_INIT;
op->release = release;
@@ -994,7 +994,7 @@ GNUNET_TESTBED_operation_queue_create_ (enum OperationQueueType type,
struct OperationQueue *queue;
struct FeedbackCtx *fctx;
- queue = GNUNET_malloc (sizeof (struct OperationQueue));
+ queue = GNUNET_new (struct OperationQueue);
queue->type = type;
if (OPERATION_QUEUE_TYPE_FIXED == type)
{
@@ -1002,7 +1002,7 @@ GNUNET_TESTBED_operation_queue_create_ (enum OperationQueueType type,
}
else
{
- fctx = GNUNET_malloc (sizeof (struct FeedbackCtx));
+ fctx = GNUNET_new (struct FeedbackCtx);
fctx->max_active_bound = max_active;
fctx->sd = GNUNET_TESTBED_SD_init_ (10); /* FIXME: Why 10? */
queue->fctx = fctx;
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c
index 5d55e3ef6..a8a87c057 100644
--- a/src/testbed/testbed_api_peers.c
+++ b/src/testbed/testbed_api_peers.c
@@ -167,7 +167,7 @@ opstart_peer_destroy (void *cls)
GNUNET_assert (OP_PEER_DESTROY == opc->type);
GNUNET_assert (NULL != peer);
opc->state = OPC_STATE_STARTED;
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerDestroyMessage));
+ msg = GNUNET_new (struct GNUNET_TESTBED_PeerDestroyMessage);
msg->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerDestroyMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER);
msg->peer_id = htonl (peer->unique_id);
@@ -219,7 +219,7 @@ opstart_peer_start (void *cls)
GNUNET_assert (NULL != (peer = data->peer));
GNUNET_assert ((TESTBED_PS_CREATED == peer->state) || (TESTBED_PS_STOPPED == peer->state));
opc->state = OPC_STATE_STARTED;
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerStartMessage));
+ msg = GNUNET_new (struct GNUNET_TESTBED_PeerStartMessage);
msg->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerStartMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_START_PEER);
msg->peer_id = htonl (peer->unique_id);
@@ -271,7 +271,7 @@ opstart_peer_stop (void *cls)
GNUNET_assert (NULL != (peer = data->peer));
GNUNET_assert (TESTBED_PS_STARTED == peer->state);
opc->state = OPC_STATE_STARTED;
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerStopMessage));
+ msg = GNUNET_new (struct GNUNET_TESTBED_PeerStopMessage);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER);
msg->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerStopMessage));
msg->peer_id = htonl (peer->unique_id);
@@ -410,7 +410,7 @@ opstart_overlay_connect (void *cls)
opc->state = OPC_STATE_STARTED;
data = opc->data;
GNUNET_assert (NULL != data);
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage));
+ msg = GNUNET_new (struct GNUNET_TESTBED_OverlayConnectMessage);
msg->header.size =
htons (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT);
@@ -570,18 +570,18 @@ GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller,
struct OperationContext *opc;
static uint32_t id_gen;
- peer = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer));
+ peer = GNUNET_new (struct GNUNET_TESTBED_Peer);
peer->controller = controller;
peer->host = host;
peer->unique_id = id_gen++;
peer->state = TESTBED_PS_INVALID;
- data = GNUNET_malloc (sizeof (struct PeerCreateData));
+ data = GNUNET_new (struct PeerCreateData);
data->host = host;
data->cfg = cfg;
data->cb = cb;
data->cls = cls;
data->peer = peer;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = controller;
opc->data = data;
opc->id = GNUNET_TESTBED_get_next_op_id (controller);
@@ -613,11 +613,11 @@ GNUNET_TESTBED_peer_start (void *op_cls, struct GNUNET_TESTBED_Peer *peer,
struct OperationContext *opc;
struct PeerEventData *data;
- data = GNUNET_malloc (sizeof (struct PeerEventData));
+ data = GNUNET_new (struct PeerEventData);
data->peer = peer;
data->pcc = pcc;
data->pcc_cls = pcc_cls;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = peer->controller;
opc->data = data;
opc->op_cls = op_cls;
@@ -653,11 +653,11 @@ GNUNET_TESTBED_peer_stop (void *op_cls,
struct OperationContext *opc;
struct PeerEventData *data;
- data = GNUNET_malloc (sizeof (struct PeerEventData));
+ data = GNUNET_new (struct PeerEventData);
data->peer = peer;
data->pcc = pcc;
data->pcc_cls = pcc_cls;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = peer->controller;
opc->data = data;
opc->op_cls = op_cls;
@@ -698,12 +698,12 @@ GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer,
GNUNET_assert (GNUNET_TESTBED_PIT_GENERIC != pit);
GNUNET_assert (NULL != cb);
- data = GNUNET_malloc (sizeof (struct PeerInfoData));
+ data = GNUNET_new (struct PeerInfoData);
data->peer = peer;
data->pit = pit;
data->cb = cb;
data->cb_cls = cb_cls;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = peer->controller;
opc->data = data;
opc->type = OP_PEER_INFO;
@@ -737,7 +737,7 @@ GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer,
struct PeerReconfigureData *data;
size_t csize;
- data = GNUNET_malloc (sizeof (struct PeerReconfigureData));
+ data = GNUNET_new (struct PeerReconfigureData);
data->peer = peer;
data->config = GNUNET_CONFIGURATION_serialize (cfg, &csize);
if (NULL == data->config)
@@ -753,7 +753,7 @@ GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer,
return NULL;
}
data->cfg_size = (uint16_t) csize;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = peer->controller;
opc->data = data;
opc->type = OP_PEER_RECONFIGURE;
@@ -780,7 +780,7 @@ GNUNET_TESTBED_peer_destroy (struct GNUNET_TESTBED_Peer *peer)
{
struct OperationContext *opc;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->data = peer;
opc->c = peer->controller;
opc->id = GNUNET_TESTBED_get_next_op_id (peer->controller);
@@ -843,12 +843,12 @@ GNUNET_TESTBED_overlay_connect (void *op_cls,
struct OverlayConnectData *data;
GNUNET_assert ((TESTBED_PS_STARTED == p1->state) && (TESTBED_PS_STARTED == p2->state));
- data = GNUNET_malloc (sizeof (struct OverlayConnectData));
+ data = GNUNET_new (struct OverlayConnectData);
data->p1 = p1;
data->p2 = p2;
data->cb = cb;
data->cb_cls = cb_cls;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->data = data;
opc->c = p1->controller;
opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
@@ -953,14 +953,14 @@ GNUNET_TESTBED_peer_manage_service (void *op_cls,
msize += sizeof (struct GNUNET_TESTBED_ManagePeerServiceMessage);
if (GNUNET_SERVER_MAX_MESSAGE_SIZE < msize)
return NULL;
- data = GNUNET_malloc (sizeof (struct ManageServiceData));
+ data = GNUNET_new (struct ManageServiceData);
data->cb = cb;
data->cb_cls = cb_cls;
data->peer = peer;
data->service_name = GNUNET_strdup (service_name);
data->start = start;
data->msize = (uint16_t) msize;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->data = data;
opc->c = peer->controller;
opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
diff --git a/src/testbed/testbed_api_sd.c b/src/testbed/testbed_api_sd.c
index 7a1da6b80..08f697248 100644
--- a/src/testbed/testbed_api_sd.c
+++ b/src/testbed/testbed_api_sd.c
@@ -109,7 +109,7 @@ GNUNET_TESTBED_SD_init_ (unsigned int max_cnt)
struct SDHandle *h;
GNUNET_assert (1 < max_cnt);
- h = GNUNET_malloc (sizeof (struct SDHandle));
+ h = GNUNET_new (struct SDHandle);
h->max_cnt = max_cnt;
return h;
}
@@ -159,7 +159,7 @@ GNUNET_TESTBED_SD_add_data_ (struct SDHandle *h, unsigned int amount)
}
GNUNET_assert (h->cnt < h->max_cnt);
if (NULL == entry)
- entry = GNUNET_malloc (sizeof (struct SDEntry));
+ entry = GNUNET_new (struct SDEntry);
entry->amount = amount;
GNUNET_CONTAINER_DLL_insert_tail (h->head, h->tail, entry);
h->sum += amount;
diff --git a/src/testbed/testbed_api_services.c b/src/testbed/testbed_api_services.c
index 86ec284ed..2c390719e 100644
--- a/src/testbed/testbed_api_services.c
+++ b/src/testbed/testbed_api_services.c
@@ -263,7 +263,7 @@ GNUNET_TESTBED_service_connect (void *op_cls, struct GNUNET_TESTBED_Peer *peer,
{
struct ServiceConnectData *data;
- data = GNUNET_malloc (sizeof (struct ServiceConnectData));
+ data = GNUNET_new (struct ServiceConnectData);
data->ca = ca;
data->da = da;
data->cada_cls = cada_cls;
diff --git a/src/testbed/testbed_api_statistics.c b/src/testbed/testbed_api_statistics.c
index 5fa0750e3..e6efc1fb0 100644
--- a/src/testbed/testbed_api_statistics.c
+++ b/src/testbed/testbed_api_statistics.c
@@ -340,7 +340,7 @@ opstart_get_stats (void *cls)
GNUNET_break (0);
continue;
}
- peer_sc = GNUNET_malloc (sizeof (struct PeerGetStatsContext));
+ peer_sc = GNUNET_new (struct PeerGetStatsContext);
peer_sc->sc = sc;
peer_sc->peer_index = peer;
sc->ops[peer] =
@@ -417,7 +417,7 @@ GNUNET_TESTBED_get_statistics (unsigned int num_peers,
if (NULL == no_wait_queue)
no_wait_queue = GNUNET_TESTBED_operation_queue_create_
(OPERATION_QUEUE_TYPE_FIXED, UINT_MAX);
- sc = GNUNET_malloc (sizeof (struct GetStatsContext));
+ sc = GNUNET_new (struct GetStatsContext);
sc->peers = peers;
sc->subsystem = (NULL == subsystem) ? NULL : GNUNET_strdup (subsystem);
sc->name = (NULL == name) ? NULL : GNUNET_strdup (name);
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c
index 0bad02a7f..cbfc4812d 100644
--- a/src/testbed/testbed_api_testbed.c
+++ b/src/testbed/testbed_api_testbed.c
@@ -592,7 +592,7 @@ wait_op_completion (void *cls)
if (NULL == rc->peers)
goto cleanup_;
rc->shutdown = GNUNET_YES;
- rcop = GNUNET_malloc (sizeof (struct RunContextOperation));
+ rcop = GNUNET_new (struct RunContextOperation);
rcop->rc = rc;
rcop->op = GNUNET_TESTBED_shutdown_peers (rc->c, rcop, NULL, NULL);
GNUNET_assert (NULL != rcop->op);
@@ -673,7 +673,7 @@ start_peers_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
rc->pstart_time = GNUNET_TIME_absolute_get ();
for (peer = 0; peer < rc->num_peers; peer++)
{
- rcop = GNUNET_malloc (sizeof (struct RunContextOperation));
+ rcop = GNUNET_new (struct RunContextOperation);
rcop->rc = rc;
rcop->op = GNUNET_TESTBED_peer_start (NULL, rc->peers[peer], NULL, NULL);
GNUNET_assert (NULL != rcop->op);
@@ -782,7 +782,7 @@ create_peers (struct GNUNET_TESTBED_RunHandle *rc)
rc->peer_count = 0;
for (peer = 0; peer < rc->num_peers; peer++)
{
- rcop = GNUNET_malloc (sizeof (struct RunContextOperation));
+ rcop = GNUNET_new (struct RunContextOperation);
rcop->rc = rc;
rcop->op =
GNUNET_TESTBED_peer_create (rc->c,
@@ -1014,7 +1014,7 @@ register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
/* Start slaves */
for (slave = 0; slave < rc->num_hosts; slave++)
{
- rcop = GNUNET_malloc (sizeof (struct RunContextOperation));
+ rcop = GNUNET_new (struct RunContextOperation);
rcop->rc = rc;
rcop->op =
GNUNET_TESTBED_controller_link (rcop, rc->c, rc->hosts[slave],
@@ -1253,7 +1253,7 @@ GNUNET_TESTBED_run (const char *host_filename,
unsigned int nhost;
GNUNET_assert (num_peers > 0);
- rc = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_RunHandle));
+ rc = GNUNET_new (struct GNUNET_TESTBED_RunHandle);
rc->cfg = GNUNET_CONFIGURATION_dup (cfg);
#if ENABLE_SUPERMUC
rc->num_hosts = GNUNET_TESTBED_hosts_load_from_loadleveler (rc->cfg,
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c
index 8d8883c96..d4eaec0c5 100644
--- a/src/testbed/testbed_api_topology.c
+++ b/src/testbed/testbed_api_topology.c
@@ -275,7 +275,7 @@ overlay_link_completed (void *cls, struct GNUNET_TESTBED_Operation *op,
{
LOG (GNUNET_ERROR_TYPE_WARNING,
"Error while establishing a link: %s -- Retrying\n", emsg);
- retry_entry = GNUNET_malloc (sizeof (struct RetryListEntry));
+ retry_entry = GNUNET_new (struct RetryListEntry);
retry_entry->link = link;
GNUNET_CONTAINER_DLL_insert_tail (tc->rl_head, tc->rl_tail, retry_entry);
}
@@ -923,7 +923,7 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
if (num_peers < 2)
return NULL;
c = peers[0]->controller;
- tc = GNUNET_malloc (sizeof (struct TopologyContext));
+ tc = GNUNET_new (struct TopologyContext);
tc->peers = peers;
tc->num_peers = num_peers;
tc->op_cls = op_cls;
diff --git a/src/testbed/testbed_logger_api.c b/src/testbed/testbed_logger_api.c
index 562902218..399e26a2f 100644
--- a/src/testbed/testbed_logger_api.c
+++ b/src/testbed/testbed_logger_api.c
@@ -277,7 +277,7 @@ queue_message (struct GNUNET_TESTBED_LOGGER_Handle *h,
type = ntohs (msg->type);
size = ntohs (msg->size);
- mq = GNUNET_malloc (sizeof (struct MessageQueue));
+ mq = GNUNET_new (struct MessageQueue);
mq->msg = msg;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Queueing message of type %u, size %u for sending\n", type,
@@ -333,7 +333,7 @@ GNUNET_TESTBED_LOGGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
client = GNUNET_CLIENT_connect ("testbed-logger", cfg);
if (NULL == client)
return NULL;
- h = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_LOGGER_Handle));
+ h = GNUNET_new (struct GNUNET_TESTBED_LOGGER_Handle);
h->client = client;
return h;
}