utils_db_query.c: fix some minor style issues
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 15 Dec 2018 18:07:56 +0000 (19:07 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 15 Dec 2018 18:40:14 +0000 (19:40 +0100)
src/utils_db_query.c

index 0279a47..81ad8b5 100644 (file)
@@ -347,39 +347,42 @@ static int udb_result_prepare_result(udb_result_t const *r, /* {{{ */
    * r->instances_buffer, r->values_buffer, and r->metadata_buffer {{{ */
   if (r->instances_num > 0) {
     prep_area->instances_pos =
-        (size_t *)calloc(r->instances_num, sizeof(size_t));
+        calloc(r->instances_num, sizeof(*prep_area->instances_pos));
     if (prep_area->instances_pos == NULL) {
       P_ERROR("udb_result_prepare_result: calloc failed.");
       BAIL_OUT(-ENOMEM);
     }
 
     prep_area->instances_buffer =
-        (char **)calloc(r->instances_num, sizeof(char *));
+        calloc(r->instances_num, sizeof(*prep_area->instances_buffer));
     if (prep_area->instances_buffer == NULL) {
       P_ERROR("udb_result_prepare_result: calloc failed.");
       BAIL_OUT(-ENOMEM);
     }
   } /* if (r->instances_num > 0) */
 
-  prep_area->values_pos = (size_t *)calloc(r->values_num, sizeof(size_t));
+  prep_area->values_pos = calloc(r->values_num, sizeof(*prep_area->values_pos));
   if (prep_area->values_pos == NULL) {
     P_ERROR("udb_result_prepare_result: calloc failed.");
     BAIL_OUT(-ENOMEM);
   }
 
-  prep_area->values_buffer = (char **)calloc(r->values_num, sizeof(char *));
+  prep_area->values_buffer =
+      calloc(r->values_num, sizeof(*prep_area->values_buffer));
   if (prep_area->values_buffer == NULL) {
     P_ERROR("udb_result_prepare_result: calloc failed.");
     BAIL_OUT(-ENOMEM);
   }
 
-  prep_area->metadata_pos = (size_t *)calloc(r->metadata_num, sizeof(size_t));
+  prep_area->metadata_pos =
+      calloc(r->metadata_num, sizeof(*prep_area->metadata_pos));
   if (prep_area->metadata_pos == NULL) {
     P_ERROR("udb_result_prepare_result: calloc failed.");
     BAIL_OUT(-ENOMEM);
   }
 
-  prep_area->metadata_buffer = (char **)calloc(r->metadata_num, sizeof(char *));
+  prep_area->metadata_buffer =
+      calloc(r->metadata_num, sizeof(*prep_area->metadata_buffer));
   if (prep_area->metadata_buffer == NULL) {
     P_ERROR("udb_result_prepare_result: calloc failed.");
     BAIL_OUT(-ENOMEM);