*/
siridb_fifo_t * siridb_fifo_new(siridb_t * siridb)
{
- siridb_fifo_t * fifo = (siridb_fifo_t *) malloc(sizeof(siridb_fifo_t));
+ siridb_fifo_t * fifo = malloc(sizeof(siridb_fifo_t));
if (fifo == NULL)
{
{
uint16_t size = siridb->pools->len;
- siridb_forward_t * forward = (siridb_forward_t *) malloc(
+ siridb_forward_t * forward = malloc(
sizeof(siridb_forward_t) + size * sizeof(qp_packer_t *));
if (forward == NULL)
{
log_info("Loading groups");
- siridb_groups_t * groups =
- (siridb_groups_t *) malloc(sizeof(siridb_groups_t));
+ siridb_groups_t * groups = malloc(sizeof(siridb_groups_t));
if (groups == NULL)
{
ERR_ALLOC
*/
siridb_initsync_t * siridb_initsync_open(siridb_t * siridb, int create_new)
{
- siridb_initsync_t * initsync =
- (siridb_initsync_t *) malloc(sizeof(siridb_initsync_t));
+ siridb_initsync_t * initsync = malloc(sizeof(siridb_initsync_t));
if (initsync == NULL)
{
ERR_ALLOC
}
else
{
- initsync->next_series_id =
- (uint32_t *) malloc(sizeof(uint32_t));
+ initsync->next_series_id = malloc(sizeof(uint32_t));
if (initsync->next_series_id == NULL)
{
ERR_ALLOC
uint16_t pid,
sirinet_stream_t * client)
{
- siridb_insert_t * insert = (siridb_insert_t *) malloc(
+ siridb_insert_t * insert = malloc(
sizeof(siridb_insert_t) +
siridb->pools->len * sizeof(qp_packer_t *));
*/
int siridb_insert_points_to_pools(siridb_insert_t * insert, size_t npoints)
{
- 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
if (ilocal->forward != NULL)
{
- uv_async_t * fwd = (uv_async_t *) malloc(sizeof(uv_async_t));
+ uv_async_t * fwd = malloc(sizeof(uv_async_t));
if (fwd == NULL || siri_err)
{
if (fwd == NULL)
sirinet_pkg_t * pkg,
uint8_t flags)
{
- sirinet_promise_t * promise =
- (sirinet_promise_t *) malloc(sizeof(sirinet_promise_t));
+ sirinet_promise_t * promise = malloc(sizeof(sirinet_promise_t));
if (promise == NULL)
{
free(pkg);
ERR_ALLOC
return -1;
}
- siridb_insert_local_t * ilocal =
- (siridb_insert_local_t *) malloc(sizeof(siridb_insert_local_t));
+ siridb_insert_local_t * ilocal = malloc(sizeof(siridb_insert_local_t));
if (ilocal == NULL)
{
free(pkg);
return -1;
}
- uv_async_t * handle = (uv_async_t *) malloc(sizeof(uv_async_t));
+ uv_async_t * handle = malloc(sizeof(uv_async_t));
if (handle == NULL)
{
free(pkg);
{
int64_t pivot, v;
- int64_t * arr_l =
- (int64_t *) malloc(sizeof(int64_t) * 2 * (points->len - 1));
+ int64_t * arr_l = malloc(sizeof(int64_t) * 2 * (points->len - 1));
if (arr_l == NULL)
{
{
double pivot, v;
- double * arr_l =
- (double *) malloc(sizeof(double) * 2 * (points->len - 1));
+ double * arr_l = malloc(sizeof(double) * 2 * (points->len - 1));
if (arr_l == NULL)
{
{
int64_t pivot, v, a, b;
- int64_t * arr_l =
- (int64_t *) malloc(sizeof(int64_t) * 2 * (points->len - 1));
+ int64_t * arr_l = malloc(sizeof(int64_t) * 2 * (points->len - 1));
if (arr_l == NULL)
{
{
double pivot, v, a, b;
- double * arr_l =
- (double *) malloc(sizeof(double) * 2 * (points->len - 1));
+ double * arr_l = malloc(sizeof(double) * 2 * (points->len - 1));
if (arr_l == NULL)
{
*/
siridb_pcache_t * siridb_pcache_new(points_tp tp)
{
- siridb_pcache_t * pcache =
- (siridb_pcache_t *) malloc(sizeof(siridb_pcache_t));
+ siridb_pcache_t * pcache = malloc(sizeof(siridb_pcache_t));
if (pcache == NULL)
{
ERR_ALLOC
pcache->size = PCACHE_DEFAULT_SIZE;
pcache->len = 0;
pcache->tp = tp;
- pcache->data = (siridb_point_t *) malloc(
- sizeof(siridb_point_t) * PCACHE_DEFAULT_SIZE);
-
+ pcache->data = malloc(sizeof(siridb_point_t) * PCACHE_DEFAULT_SIZE);
if (pcache->data == NULL)
{
ERR_ALLOC
{
if (pcache->len == pcache->size)
{
+ siridb_point_t * tmp;
pcache->size *= 2;
- siridb_point_t * tmp = (siridb_point_t *) realloc(
- pcache->data,
- sizeof(siridb_point_t) * pcache->size);
+ tmp = realloc(pcache->data, sizeof(siridb_point_t) * pcache->size);
if (tmp == NULL)
{
log_error(
size_t sz = sizeof(siridb_point_t) * points->len;
cpoints->len = points->len;
cpoints->tp = points->tp;
- cpoints->data = (siridb_point_t *) malloc(sz);
+ cpoints->data = malloc(sz);
if (cpoints->data == NULL)
{
free(cpoints);
*cinfo <<= 8;
*cinfo |= tcount | (shift << 4);
*size = 16 + shift - tcount + (tcount + vcount) * (end - start - 1);
- bits = (unsigned char *) malloc(*size);
+ bits = malloc(*size);
if (bits == NULL)
{
return NULL;
*size = sizeof(uint64_t);
return siridb_points_raw_string(points, start, end, cinfo, size);
}
- size_t * sizes = (size_t *) malloc(sizeof(size_t) * n);
+ size_t * sizes = malloc(sizeof(size_t) * n);
if (sizes == NULL)
{
return NULL;
/* calculate time-stamps size */
sz = 13 + shift + tinfo*(n - 2);
- src = (uint8_t *) malloc(sz_src);
- out = (uint8_t *) malloc(sz + sz_src + (is_ascii ? 0 : (n * 8)));
+ src = malloc(sz_src);
+ out = malloc(sz + sz_src + (is_ascii ? 0 : (n * 8)));
if (src == NULL || out == NULL)
{
goto failed;
*size = 0;
uint_fast32_t n = end - start;
- size_t * sizes = (size_t *) malloc(sizeof(size_t) * n);
+ size_t * sizes = malloc(sizeof(size_t) * n);
size_t * psz = sizes;
unsigned char * pdata;
unsigned char * cdata;
*cinfo <<= 8;
*cinfo |= tcount | (shift << 4);
*size = 16 + shift - tcount + (tcount + vcount) * (end - start - 1);
- bits = (unsigned char *) malloc(*size);
+ bits = malloc(*size);
if (bits == NULL)
{
return NULL;
memcpy(&point->ts, pt, sizeof(uint64_t));
pt += sizeof(uint64_t);
- buf = (uint8_t *) malloc(src_sz);
+ buf = malloc(src_sz);
if (buf == NULL)
{
return -1;
*size = n * 16;
*cinfo = 0xffff;
- bits = (unsigned char *) malloc(*size);
+ bits = malloc(*size);
if (bits == NULL)
{
return NULL;
switch (ps_children->node->cl_obj->gid)
{
case CLERI_GID_K_PREFIX:
- nps->prefix =
- (char *) malloc(ps_children->next->node->len + 1);
+ nps->prefix = malloc(ps_children->next->node->len + 1);
if (nps->prefix != NULL)
{
/* not critical if suffix is still NULL */
}
break;
case CLERI_GID_K_SUFFIX:
- nps->suffix =
- (char *) malloc(ps_children->next->node->len + 1);
+ nps->suffix = malloc(ps_children->next->node->len + 1);
if (nps->suffix != NULL)
{
/* not critical if suffix is still NULL */
*/
siridb_presuf_t * PRESUF_add(siridb_presuf_t ** presuf)
{
- siridb_presuf_t * newps =
- (siridb_presuf_t *) malloc(sizeof(siridb_presuf_t));
+ siridb_presuf_t * newps = malloc(sizeof(siridb_presuf_t));
if (newps == NULL)
{
ERR_ALLOC
*/
siridb_reindex_t * siridb_reindex_open(siridb_t * siridb, int create_new)
{
- siridb_reindex_t * reindex =
- (siridb_reindex_t *) malloc(sizeof(siridb_reindex_t));
+ siridb_reindex_t * reindex = malloc(sizeof(siridb_reindex_t));
if (reindex == NULL)
{
ERR_ALLOC
}
else if (reindex->size)
{
- reindex->next_series_id =
- (uint32_t *) malloc(sizeof(uint32_t));
+ reindex->next_series_id = malloc(sizeof(uint32_t));
if (reindex->next_series_id == NULL)
{
}
else
{
- reindex->timer =
- (uv_timer_t *) malloc(sizeof(uv_timer_t));
+ reindex->timer = malloc(sizeof(uv_timer_t));
if (reindex->timer == NULL)
{
ERR_ALLOC
const char * name)
{
uint32_t n;
- siridb_series_t * series;
- series = (siridb_series_t *) malloc(sizeof(siridb_series_t));
+ siridb_series_t * series = malloc(sizeof(siridb_series_t));
if (series == NULL)
{
ERR_ALLOC
else if (size)
{
- buffer = (char *) malloc(size);
+ buffer = malloc(size);
if (buffer == NULL)
{
log_critical("Cannot allocate buffer for reading dropped series");