/* in case of a string, set the value and return */
if (node->cl_obj->gid == CLERI_GID_STRING)
{
- (*condition)->str = (char *) malloc(node->len -1);
+ (*condition)->str = malloc(node->len -1);
if ((*condition)->str == NULL)
{
return NULL;
*/
static cexpr_t * CEXPR_new(void)
{
- cexpr_t * cexpr = (cexpr_t *) malloc(sizeof(cexpr_t));
+ cexpr_t * cexpr = malloc(sizeof(cexpr_t));
if (cexpr != NULL)
{
cexpr->operator = CEXPR_AND;
{
cfgparser_t * cfgparser;
- cfgparser = (cfgparser_t *) malloc(sizeof(cfgparser_t));
+ cfgparser = malloc(sizeof(cfgparser_t));
if (cfgparser != NULL)
{
cfgparser->sections = NULL;
if (current == NULL)
{
- cfgparser->sections =
- (cfgparser_section_t *) malloc(sizeof(cfgparser_section_t));
+ cfgparser->sections = malloc(sizeof(cfgparser_section_t));
if (cfgparser->sections == NULL)
{
ERR_ALLOC
}
current = current->next;
}
- current->next =
- (cfgparser_section_t *) malloc(sizeof(cfgparser_section_t));
+ current->next = malloc(sizeof(cfgparser_section_t));
if (current->next == NULL)
{
ERR_ALLOC
const char * val,
const char * def)
{
- cfgparser_via_t * val_u = (cfgparser_via_t *) malloc(sizeof(cfgparser_via_t));
- cfgparser_via_t * def_u = (cfgparser_via_t *) malloc(sizeof(cfgparser_via_t));
+ cfgparser_via_t * val_u = malloc(sizeof(cfgparser_via_t));
+ cfgparser_via_t * def_u = malloc(sizeof(cfgparser_via_t));
if (val_u == NULL || def_u == NULL)
{
int32_t val,
int32_t def)
{
- cfgparser_via_t * val_u = (cfgparser_via_t *) malloc(sizeof(cfgparser_via_t));
- cfgparser_via_t * def_u = (cfgparser_via_t *) malloc(sizeof(cfgparser_via_t));
+ cfgparser_via_t * val_u = malloc(sizeof(cfgparser_via_t));
+ cfgparser_via_t * def_u = malloc(sizeof(cfgparser_via_t));
if (val_u == NULL || def_u == NULL)
{
ERR_ALLOC
double val,
double def)
{
- cfgparser_via_t * val_u = (cfgparser_via_t *) malloc(sizeof(cfgparser_via_t));
- cfgparser_via_t * def_u = (cfgparser_via_t *) malloc(sizeof(cfgparser_via_t));
+ cfgparser_via_t * val_u = malloc(sizeof(cfgparser_via_t));
+ cfgparser_via_t * def_u = malloc(sizeof(cfgparser_via_t));
if (val_u == NULL || def_u == NULL)
{
ERR_ALLOC
if (current == NULL)
{
- section->options =
- (cfgparser_option_t *) malloc(sizeof(cfgparser_option_t));
+ section->options = malloc(sizeof(cfgparser_option_t));
if (section->options == NULL)
{
ERR_ALLOC
current = current->next;
}
- prev->next = (cfgparser_option_t *) malloc(sizeof(cfgparser_option_t));
+ prev->next = malloc(sizeof(cfgparser_option_t));
if (prev->next == NULL)
{
ERR_ALLOC
*/
ct_t * ct_new(void)
{
- ct_t * ct = (ct_t *) malloc(sizeof(ct_t));
+ ct_t * ct = malloc(sizeof(ct_t));
if (ct == NULL)
{
return NULL;
size_t len = 1;
ct_node_t * nd;
int rc = 0;
- char * buffer = (char *) malloc(buffer_sz);
+ char * buffer = malloc(buffer_sz);
uint_fast16_t i, end;
if (buffer == NULL)
*/
static ct_node_t * CT_node_new(const char * key, size_t len, void * data)
{
- ct_node_t * node = (ct_node_t *) malloc(sizeof(ct_node_t));
+ ct_node_t * node = malloc(sizeof(ct_node_t));
if (node == NULL)
{
return NULL;
node->nodes = NULL;
if (len)
{
- node->key = (char *) malloc(len);
+ node->key = malloc(len);
if (node->key == NULL)
{
free(node);
*/
llist_t * llist_new(void)
{
- llist_t * llist = (llist_t *) malloc(sizeof(llist_t));
+ llist_t * llist = malloc(sizeof(llist_t));
if (llist == NULL)
{
return NULL;
*/
static llist_node_t * LLIST_node_new(void * data)
{
- llist_node_t * llist_node;
- llist_node = (llist_node_t *) malloc(sizeof(llist_node_t));
+ llist_node_t * llist_node = malloc(sizeof(llist_node_t));
if (llist_node == NULL)
{
return NULL;
return -1;
}
- struct proc_fdinfo * fd_info = (struct proc_fdinfo *) malloc(buffer_size);
+ struct proc_fdinfo * fd_info = malloc(buffer_size);
if (fd_info == NULL)
{
*/
qp_packer_t * qp_packer_new(size_t alloc_size)
{
- qp_packer_t * packer = (qp_packer_t *) malloc(sizeof(qp_packer_t));
+ qp_packer_t * packer = malloc(sizeof(qp_packer_t));
if (packer != NULL)
{
packer->alloc_size = alloc_size;
packer->buffer_size = packer->alloc_size;
packer->len = 0;
- packer->buffer = (unsigned char *) malloc(packer->buffer_size);
+ packer->buffer = malloc(packer->buffer_size);
if (packer->buffer == NULL)
{
free(packer);
*/
static siridb_aggr_t * AGGREGATE_new(uint32_t gid)
{
- siridb_aggr_t * aggr = (siridb_aggr_t *) malloc(sizeof(siridb_aggr_t));
+ siridb_aggr_t * aggr = malloc(sizeof(siridb_aggr_t));
if (aggr == NULL)
{
return NULL;
case CLERI_GID_STRING:
aggr->filter_tp = TP_STRING;
- aggr->filter_via.raw = (unsigned char *) malloc(node->len - 1);
+ aggr->filter_via.raw = malloc(node->len - 1);
if (aggr->filter_via.raw == NULL)
{
sprintf(err_msg, "Memory allocation error.");
*/
static siridb_t * siridb__new(void)
{
- siridb_t * siridb = (siridb_t *) malloc(sizeof(siridb_t));
+ siridb_t * siridb = malloc(sizeof(siridb_t));
if (siridb == NULL)
{
goto fail0;
query_select_t * query_select_new(void)
{
- query_select_t * q_select =
- (query_select_t *) malloc(sizeof(query_select_t));
+ query_select_t * q_select = malloc(sizeof(query_select_t));
if (q_select == NULL)
{
query_alter_t * query_alter_new(void)
{
- query_alter_t * q_alter =
- (query_alter_t *) malloc(sizeof(query_alter_t));
+ query_alter_t * q_alter = malloc(sizeof(query_alter_t));
if (q_alter == NULL)
{
query_count_t * query_count_new(void)
{
- query_count_t * q_count =
- (query_count_t *) malloc(sizeof(query_count_t));
+ query_count_t * q_count = malloc(sizeof(query_count_t));
if (q_count == NULL)
{
query_drop_t * query_drop_new(void)
{
- query_drop_t * q_drop =
- (query_drop_t *) malloc(sizeof(query_drop_t));
+ query_drop_t * q_drop = malloc(sizeof(query_drop_t));
if (q_drop == NULL)
{
query_list_t * query_list_new(void)
{
- query_list_t * q_list =
- (query_list_t *) malloc(sizeof(query_list_t));
+ query_list_t * q_list = malloc(sizeof(query_list_t));
if (q_list == NULL)
{
void query_alter_free(uv_handle_t * handle)
{
- query_alter_t * q_alter =
- (query_alter_t *) ((siridb_query_t *) handle->data)->data;
+ query_alter_t * q_alter = ((siridb_query_t *) handle->data)->data;
switch (q_alter->alter_tp)
{
void query_count_free(uv_handle_t * handle)
{
- query_count_t * q_count =
- (query_count_t *) ((siridb_query_t *) handle->data)->data;
+ query_count_t * q_count = ((siridb_query_t *) handle->data)->data;
QUERIES_FREE(q_count, handle)
}
void query_drop_free(uv_handle_t * handle)
{
- query_drop_t * q_drop =
- (query_drop_t *) ((siridb_query_t *) handle->data)->data;
+ query_drop_t * q_drop = ((siridb_query_t *) handle->data)->data;
if (q_drop->shards_list != NULL)
{
siridb_shard_t * shard;
while (q_drop->shards_list->len)
{
- shard = (siridb_shard_t *) vec_pop(q_drop->shards_list);
+ shard = vec_pop(q_drop->shards_list);
siridb_shard_decref(shard);
}
void query_list_free(uv_handle_t * handle)
{
- query_list_t * q_list =
- (query_list_t *) ((siridb_query_t *) handle->data)->data;
+ query_list_t * q_list = ((siridb_query_t *) handle->data)->data;
if (q_list->props != NULL)
{
void query_select_free(uv_handle_t * handle)
{
- query_select_t * q_select =
- (query_select_t *) ((siridb_query_t *) handle->data)->data;
+ query_select_t * q_select = ((siridb_query_t *) handle->data)->data;
siridb_presuf_free(q_select->presuf);
float factor,
int flags)
{
- uv_async_t * handle = (uv_async_t *) malloc(sizeof(uv_async_t));
+ uv_async_t * handle = malloc(sizeof(uv_async_t));
if (handle == NULL)
{
ERR_ALLOC
return;
}
- siridb_query_t * query = (siridb_query_t *) malloc(sizeof(siridb_query_t));
+ siridb_query_t * query = malloc(sizeof(siridb_query_t));
if (query == NULL)
{
ERR_ALLOC
return;
}
- uv_async_t * forward = (uv_async_t *) malloc(sizeof(uv_async_t));
+ uv_async_t * forward = malloc(sizeof(uv_async_t));
uv_async_init(siri.loop, forward, (uv_async_cb) query->nodes->cb);
forward->data = handle->data;
uv_async_send(forward);
uint16_t port,
uint16_t pool)
{
- siridb_server_t * server =
- (siridb_server_t *) malloc(sizeof(siridb_server_t));
+ siridb_server_t * server = malloc(sizeof(siridb_server_t));
if (server == NULL)
{
ERR_ALLOC
assert (cb != NULL);
int rc;
uint8_t n = 0;
- sirinet_promise_t * promise =
- (sirinet_promise_t *) malloc(sizeof(sirinet_promise_t));
+ sirinet_promise_t * promise = malloc(sizeof(sirinet_promise_t));
if (promise == NULL)
{
ERR_ALLOC
return -1;
}
- promise->timer = (uv_timer_t *) malloc(sizeof(uv_timer_t));
+ promise->timer = malloc(sizeof(uv_timer_t));
if (promise->timer == NULL)
{
ERR_ALLOC
promise->server = server;
promise->data = data;
- uv_write_t * req = (uv_write_t *) malloc(sizeof(uv_write_t));
+ uv_write_t * req = malloc(sizeof(uv_write_t));
if (req == NULL)
{
ERR_ALLOC
/* IPv4 */
struct sockaddr_in dest;
- uv_connect_t * req = (uv_connect_t *) malloc(sizeof(uv_connect_t));
+ uv_connect_t * req = malloc(sizeof(uv_connect_t));
if (req == NULL)
{
ERR_ALLOC
/* IPv6 */
struct sockaddr_in6 dest6;
- uv_connect_t * req = (uv_connect_t *) malloc(sizeof(uv_connect_t));
+ uv_connect_t * req = malloc(sizeof(uv_connect_t));
if (req == NULL)
{
ERR_ALLOC
addr, server->name);
}
- uv_connect_t * req = (uv_connect_t *) malloc(sizeof(uv_connect_t));
+ uv_connect_t * req = malloc(sizeof(uv_connect_t));
if (req == NULL)
{
ERR_ALLOC
int is_ts64;
FILE * fp;
off_t shard_sz;
- siridb_shard_t * shard = (siridb_shard_t *) malloc(sizeof(siridb_shard_t));
+ siridb_shard_t * shard = malloc(sizeof(siridb_shard_t));
if (shard == NULL)
{
uint8_t tp,
siridb_shard_t * replacing)
{
- siridb_shard_t * shard = (siridb_shard_t *) malloc(sizeof(siridb_shard_t));
+ siridb_shard_t * shard = malloc(sizeof(siridb_shard_t));
if (shard == NULL)
{
ERR_ALLOC
{
size_t p = 0;
size_t ts_sz = siridb->time->ts_sz;
- cdata = (unsigned char *) malloc(dsize);
+ cdata = malloc(dsize);
if (cdata == NULL)
{
ERR_ALLOC
}
}
- temp = (uint32_t *) malloc(sizeof(uint32_t) * idx->len * 3);
+ temp = malloc(sizeof(uint32_t) * idx->len * 3);
if (temp == NULL)
{
log_critical("Memory allocation error");
}
}
- temp = (uint64_t *) malloc(sizeof(uint64_t) * idx->len * 2);
+ temp = malloc(sizeof(uint64_t) * idx->len * 2);
if (temp == NULL)
{
log_critical("Memory allocation error");
}
}
- bits = (unsigned char *) malloc(size);
+ bits = malloc(size);
if (bits == NULL)
{
log_critical("Memory allocation error");
return -1;
}
}
- bits = (uint8_t *) malloc(size);
+ bits = malloc(size);
if (bits == NULL)
{
free(bits);
}
}
- tdata = (uint32_t *) malloc(sizeof(uint32_t) * idx->len);
- cdata = (char *) malloc(dsize);
+ tdata = malloc(sizeof(uint32_t) * idx->len);
+ cdata = malloc(dsize);
if (cdata == NULL || tdata == NULL)
{
free(tdata);
}
}
- tdata = (uint64_t *) malloc(sizeof(uint64_t) * idx->len);
- cdata = (char *) malloc(dsize);
+ tdata = malloc(sizeof(uint64_t) * idx->len);
+ cdata = malloc(dsize);
if (cdata == NULL || tdata == NULL)
{
free(tdata);
}
n = SIRIDB_SHARD_MAX_CHUNK_SZ / idx_sz;
- data = (char *) malloc(n * idx_sz);
+ data = malloc(n * idx_sz);
if (data == NULL)
{
*/
siridb_time_t * siridb_time_new(siridb_timep_t precision)
{
- siridb_time_t * time = (siridb_time_t *) malloc(sizeof(siridb_time_t));
+ siridb_time_t * time = malloc(sizeof(siridb_time_t));
if (time == NULL)
{
ERR_ALLOC
*/
siridb_user_t * siridb_user_new(void)
{
- siridb_user_t * user = (siridb_user_t *) malloc(sizeof(siridb_user_t));
+ siridb_user_t * user = malloc(sizeof(siridb_user_t));
if (user == NULL)
{
ERR_ALLOC
const uint64_t now,
uint8_t * flags)
{
- siridb_walker_t * walker =
- (siridb_walker_t *) malloc(sizeof(siridb_walker_t));
+ siridb_walker_t * walker = malloc(sizeof(siridb_walker_t));
if (walker == NULL)
{
ERR_ALLOC
cleri_node_t * node,
uv_async_cb cb)
{
- siridb_nodes_t * wnode =
- (siridb_nodes_t *) malloc(sizeof(siridb_nodes_t));
+ siridb_nodes_t * wnode = malloc(sizeof(siridb_nodes_t));
if (wnode == NULL)
{
ERR_ALLOC
{
siridb_nodes_t * current = walker->exit_nodes;
- walker->exit_nodes =
- (siridb_nodes_t *) malloc(sizeof(siridb_nodes_t));
+ walker->exit_nodes = malloc(sizeof(siridb_nodes_t));
if (walker->exit_nodes == NULL)
{
ERR_ALLOC
siri_fh_t * siri_fh_new(uint16_t size)
{
- siri_fh_t * fh = (siri_fh_t *) malloc(sizeof(siri_fh_t));
+ siri_fh_t * fh = malloc(sizeof(siri_fh_t));
if (fh == NULL)
{
ERR_ALLOC
{
fh->size = size;
fh->idx = 0;
- fh->fpointers = (siri_fp_t **) calloc(size, sizeof(siri_fp_t *));
+ fh->fpointers = calloc(size, sizeof(siri_fp_t *));
if (fh->fpointers == NULL)
{
ERR_ALLOC
*/
siri_fp_t * siri_fp_new(void)
{
- siri_fp_t * fp = (siri_fp_t *) malloc(sizeof(siri_fp_t));
+ siri_fp_t * fp = malloc(sizeof(siri_fp_t));
if (fp == NULL)
{
ERR_ALLOC
uv_tcp_init(siri.loop, (uv_tcp_t *) siri.client->stream);
- adm_client = (siri_service_client_t *) malloc(sizeof(siri_service_client_t));
+ adm_client = malloc(sizeof(siri_service_client_t));
if (adm_client == NULL)
{
sirinet_stream_decref(siri.client);
/* IPv4 */
struct sockaddr_in dest;
- uv_connect_t * req = (uv_connect_t *) malloc(sizeof(uv_connect_t));
+ uv_connect_t * req = malloc(sizeof(uv_connect_t));
if (req == NULL)
{
sirinet_stream_decref(siri.client);
/* IPv6 */
struct sockaddr_in6 dest6;
- uv_connect_t * req = (uv_connect_t *) malloc(sizeof(uv_connect_t));
+ uv_connect_t * req = malloc(sizeof(uv_connect_t));
if (req == NULL)
{
sirinet_stream_decref(siri.client);
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = AI_NUMERICSERV;
- uv_getaddrinfo_t * resolver =
- (uv_getaddrinfo_t *) malloc(sizeof(uv_getaddrinfo_t));
+ uv_getaddrinfo_t * resolver = malloc(sizeof(uv_getaddrinfo_t));
if (resolver == NULL)
{
}
else
{
- uv_connect_t * req = (uv_connect_t *) malloc(sizeof(uv_connect_t));
+ uv_connect_t * req = malloc(sizeof(uv_connect_t));
if (req == NULL)
{
CLIENT_err(adm_client, "memory allocation error");
siri_service_client_t * adm_client,
sirinet_pkg_t * pkg)
{
- uv_write_t * req = (uv_write_t *) malloc(sizeof(uv_write_t));
+ uv_write_t * req = malloc(sizeof(uv_write_t));
if (req == NULL)
{
free(pkg);
siri.fh = siri_fh_new(siri.cfg->max_open_files);
/* initialize the default event loop */
- siri.loop = (uv_loop_t *) malloc(sizeof(uv_loop_t));
+ siri.loop = malloc(sizeof(uv_loop_t));
if (siri.loop == NULL)
{
return -1;