Remove unnecessary (and perilous) function pointer cast.
authorMarcello Stanisci <stanisci.m@gmail.com>
Wed, 24 Oct 2018 10:52:58 +0000 (12:52 +0200)
committerMarcello Stanisci <stanisci.m@gmail.com>
Wed, 24 Oct 2018 10:52:58 +0000 (12:52 +0200)
src/curl/curl_reschedule.c

index 0b5b85687873a126448c046b5c4c8c5b6cc2e25e..cc3c1db950da41d3f01833a11cff7280df4e5420 100644 (file)
@@ -77,6 +77,18 @@ GNUNET_CURL_gnunet_rc_create_with_parser (struct GNUNET_CURL_Context *ctx,
   return rctx;
 }
 
+
+/**
+ * Just a wrapper to avoid casting of function pointers.
+ *
+ * @param response the (JSON) response to clean.
+ */
+static void
+clean_result (void *response)
+{
+  json_decref (response);
+}
+
 /**
  * Initialize reschedule context.
  *
@@ -90,8 +102,8 @@ GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx)
 
   rc = GNUNET_new (struct GNUNET_CURL_RescheduleContext);
   rc->ctx = ctx;
-  rc->parser = (GNUNET_CURL_RawParser) &download_get_result;
-  rc->cleaner = (GNUNET_CURL_ResponseCleaner) &json_decref;
+  rc->parser = &download_get_result;
+  rc->cleaner = &clean_result;
   return rc;
 }