Removed some not required void* casts
authorJeroen van der Heijden <jeroen@transceptor.technology>
Thu, 3 Jan 2019 13:35:05 +0000 (14:35 +0100)
committerJeroen van der Heijden <jeroen@transceptor.technology>
Thu, 3 Jan 2019 13:35:05 +0000 (14:35 +0100)
src/siri/db/fifo.c
src/siri/db/forward.c
src/siri/db/groups.c
src/siri/db/initsync.c
src/siri/db/insert.c
src/siri/db/median.c
src/siri/db/pcache.c
src/siri/db/points.c
src/siri/db/presuf.c
src/siri/db/reindex.c
src/siri/db/series.c

index e6c069021ac3ee0f54b8634074617b053fda6b49..10b7b01b569ecd947e82bfde18bf0ee080273055 100644 (file)
@@ -26,7 +26,7 @@ static int FIFO_init(siridb_fifo_t * fifo);
  */
 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)
     {
index c63706cdc56ca061b35449709a40646e4d23130f..b375b5eddad1a9f6e4aa41d30f8ac378c3607934 100644 (file)
@@ -19,7 +19,7 @@ siridb_forward_t * siridb_forward_new(siridb_t * siridb)
 {
     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)
index cc2916c86bfde63407d81ca50752ba8e268b6e11..16fe0049f54416a4540cb16271c24cbbacca37b4 100644 (file)
@@ -63,8 +63,7 @@ siridb_groups_t * siridb_groups_new(siridb_t * siridb)
 {
     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
index 4dd9e60432a8ef37a845693f0eada41bd91ed4d8..771dcbe9a89ffe327745eb7e806422a45f304763 100644 (file)
@@ -47,8 +47,7 @@ static char sync_progress[30];
  */
 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
@@ -74,8 +73,7 @@ siridb_initsync_t * siridb_initsync_open(siridb_t * siridb, int create_new)
             }
             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
index e8f1eebefebd73192346ab7fd0ced8181231a26a..198bcaa6fd8e9642292bc37a662bcf440b1267f8 100644 (file)
@@ -199,7 +199,7 @@ siridb_insert_t * siridb_insert_new(
         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 *));
 
@@ -258,7 +258,7 @@ siridb_insert_t * siridb_insert_new(
  */
 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
@@ -456,7 +456,7 @@ static void INSERT_local_free_cb(uv_async_t * handle)
 
     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)
@@ -1005,16 +1005,14 @@ static int INSERT_init_local(
         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);
@@ -1023,7 +1021,7 @@ static int INSERT_init_local(
         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);
index a5da036b1500e09b314e01dc092e836473b84fcf..346781ea3ae52d36ea19cebf398be449c6fae247 100644 (file)
@@ -55,8 +55,7 @@ int siridb_median_find_n(
     {
         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)
         {
@@ -111,8 +110,7 @@ int siridb_median_find_n(
     {
         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)
         {
@@ -186,8 +184,7 @@ int siridb_median_real(
     {
         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)
         {
@@ -263,8 +260,7 @@ int siridb_median_real(
     {
         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)
         {
index fe99bca56c3098363a66e47c96e4166fe120b828..f45dcd72c768216f01c9514bc82a0dbb2837a1f7 100644 (file)
@@ -15,8 +15,7 @@
  */
 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
@@ -26,9 +25,7 @@ siridb_pcache_t * siridb_pcache_new(points_tp tp)
         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
@@ -52,10 +49,9 @@ int siridb_pcache_add_point(
 {
     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(
index caf842d4e7c8e302a72d181b8a9e53fac33674fc..18788724ca0f4ba5872ea33f755e65df9d76a2b0 100644 (file)
@@ -117,7 +117,7 @@ siridb_points_t * siridb_points_copy(siridb_points_t * points)
         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);
@@ -457,7 +457,7 @@ unsigned char * siridb_points_zip_int(
     *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;
@@ -528,7 +528,7 @@ unsigned char * siridb_points_zip_string(
         *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;
@@ -578,8 +578,8 @@ unsigned char * siridb_points_zip_string(
     /* 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;
@@ -659,7 +659,7 @@ unsigned char * siridb_points_raw_string(
     *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;
@@ -784,7 +784,7 @@ unsigned char * siridb_points_zip_double(
     *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;
@@ -1177,7 +1177,7 @@ int siridb_points_unzip_string(
     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;
@@ -1276,7 +1276,7 @@ static unsigned char * POINTS_zip_raw(
     *size = n * 16;
     *cinfo = 0xffff;
 
-    bits = (unsigned char *) malloc(*size);
+    bits = malloc(*size);
     if (bits == NULL)
     {
         return NULL;
index 4800798dbf03a52e2d08b43599e8f12d3f203225..4de324caaa9eeffb5a7d1e1311846d2af229d30e 100644 (file)
@@ -67,8 +67,7 @@ siridb_presuf_t * siridb_presuf_add(
             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 */
@@ -79,8 +78,7 @@ siridb_presuf_t * siridb_presuf_add(
                 }
                 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 */
@@ -153,8 +151,7 @@ const char * siridb_presuf_name(
  */
 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
index afebf0ff712c1494c3a652abc3c56c3878c80133..d85e94c2b2aec4657509e777e543f78807efe007 100644 (file)
@@ -66,8 +66,7 @@ static char reindex_progress[30];
  */
 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
@@ -127,8 +126,7 @@ siridb_reindex_t * siridb_reindex_open(siridb_t * siridb, int create_new)
                     }
                     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)
                         {
@@ -147,8 +145,7 @@ siridb_reindex_t * siridb_reindex_open(siridb_t * siridb, int create_new)
                         }
                         else
                         {
-                            reindex->timer =
-                                    (uv_timer_t *) malloc(sizeof(uv_timer_t));
+                            reindex->timer = malloc(sizeof(uv_timer_t));
                             if (reindex->timer == NULL)
                             {
                                 ERR_ALLOC
index d7e9e54ba4a49e34cfbb15e3e63137f3be4dc133..3d6d12b86fc67690671459d77ff88c5c55ab4707 100644 (file)
@@ -1317,8 +1317,7 @@ static siridb_series_t * SERIES_new(
         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
@@ -1473,7 +1472,7 @@ static int SERIES_read_dropped(siridb_t * siridb, imap_t * dropped)
     else if (size)
     {
 
-        buffer = (char *) malloc(size);
+        buffer = malloc(size);
         if (buffer == NULL)
         {
             log_critical("Cannot allocate buffer for reading dropped series");