gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: build: more style warning fixes


From: gnunet
Subject: [gnunet] branch master updated: build: more style warning fixes
Date: Fri, 06 Sep 2024 10:34:22 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new d40f32daf build: more style warning fixes
d40f32daf is described below

commit d40f32dafb49afd9a51a4c17dcbdeefcc2091e58
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Fri Sep 6 10:34:16 2024 +0200

    build: more style warning fixes
---
 src/lib/gnsrecord/gnsrecord.c                 |  4 +--
 src/lib/gnsrecord/gnsrecord_misc.c            | 29 --------------------
 src/lib/gnsrecord/gnsrecord_pow.c             | 25 ++++++++----------
 src/lib/hello/hello-uri.c                     |  2 +-
 src/lib/util/scheduler.c                      | 37 +++++++++++++-------------
 src/lib/util/strings.c                        | 13 ++++-----
 src/service/core/gnunet-service-core_kx.c     |  6 ++---
 src/service/gns/gnunet-dns2gns.c              |  7 +++--
 src/service/gns/gnunet-gns-proxy.c            | 36 ++++++++++++-------------
 src/service/gns/gnunet-service-gns_resolver.c | 38 +++++++++++++--------------
 src/service/namestore/namestore_api.c         |  2 +-
 src/service/reclaim/reclaim_credential.c      |  6 ++---
 src/service/rest/gnunet-rest-server.c         | 14 +++++-----
 src/service/util/gnunet-service-resolver.c    |  7 +++--
 14 files changed, 95 insertions(+), 131 deletions(-)

diff --git a/src/lib/gnsrecord/gnsrecord.c b/src/lib/gnsrecord/gnsrecord.c
index c71dc1708..bd048171e 100644
--- a/src/lib/gnsrecord/gnsrecord.c
+++ b/src/lib/gnsrecord/gnsrecord.c
@@ -25,9 +25,7 @@
  * @author Matthias Wachs
  * @author Christian Grothoff
  */
-#include "platform.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_constants.h"
 #include "gnunet_gnsrecord_lib.h"
 #include "gnunet_gnsrecord_plugin.h"
 
@@ -113,7 +111,7 @@ init ()
 /**
  * Dual function to #init().
  */
-void __attribute__ ((destructor))
+static void __attribute__ ((destructor))
 GNSRECORD_fini ()
 {
   struct Plugin *plugin;
diff --git a/src/lib/gnsrecord/gnsrecord_misc.c 
b/src/lib/gnsrecord/gnsrecord_misc.c
index 8d50bc8d4..e7c7d755b 100644
--- a/src/lib/gnsrecord/gnsrecord_misc.c
+++ b/src/lib/gnsrecord/gnsrecord_misc.c
@@ -27,9 +27,6 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_constants.h"
-#include "gnunet_signatures.h"
-#include "gnunet_arm_service.h"
 #include "gnunet_gnsrecord_lib.h"
 
 
@@ -376,32 +373,6 @@ GNUNET_GNSRECORD_query_from_block (const struct 
GNUNET_GNSRECORD_Block *block,
 }
 
 
-enum GNUNET_GenericReturnValue
-GNUNET_GNSRECORD_record_to_identity_key (const struct GNUNET_GNSRECORD_Data 
*rd,
-                                         struct GNUNET_CRYPTO_PublicKey *key)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Got record of type %u\n",
-              rd->record_type);
-  switch (rd->record_type)
-  {
-  case GNUNET_GNSRECORD_TYPE_PKEY:
-    key->type = htonl (rd->record_type);
-    memcpy (&key->ecdsa_key, rd->data, sizeof (key->ecdsa_key));
-    return GNUNET_OK;
-  case GNUNET_GNSRECORD_TYPE_EDKEY:
-    key->type = htonl (rd->record_type);
-    memcpy (&key->eddsa_key, rd->data, sizeof (key->eddsa_key));
-    return GNUNET_OK;
-  default:
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_SYSERR;
-
-
-}
-
-
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_normalize_record_set (const char *label,
                                        const struct
diff --git a/src/lib/gnsrecord/gnsrecord_pow.c 
b/src/lib/gnsrecord/gnsrecord_pow.c
index a40dd7802..0977eed1f 100644
--- a/src/lib/gnsrecord/gnsrecord_pow.c
+++ b/src/lib/gnsrecord/gnsrecord_pow.c
@@ -23,11 +23,10 @@
  * @brief API for proof of work
  * @author Martin Schanzenbach
  */
-#include "platform.h"
+#include "gnunet_common.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_gnsrecord_lib.h"
 #include "gnunet_signatures.h"
-#include "gnunet_protocols.h"
 #include <inttypes.h>
 
 /**
@@ -96,12 +95,11 @@ calculate_score (const struct 
GNUNET_GNSRECORD_PowCalculationHandle *ph)
   double sum = 0.0;
   for (unsigned int j = 0; j<POW_COUNT; j++)
     sum += ph->best[j].bits;
-  double avg = sum / POW_COUNT;
-  return avg;
+  return sum / POW_COUNT;
 }
 
 
-struct GNUNET_GNSRECORD_SignaturePurposePS *
+static struct GNUNET_GNSRECORD_SignaturePurposePS *
 GNR_create_signature_message (const struct GNUNET_GNSRECORD_PowP *pow)
 {
   struct GNUNET_GNSRECORD_SignaturePurposePS *spurp;
@@ -121,7 +119,7 @@ GNR_create_signature_message (const struct 
GNUNET_GNSRECORD_PowP *pow)
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 check_signature_identity (const struct GNUNET_GNSRECORD_PowP *pow,
                           const struct GNUNET_CRYPTO_PublicKey *key)
 {
@@ -144,7 +142,7 @@ check_signature_identity (const struct 
GNUNET_GNSRECORD_PowP *pow,
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 check_signature (const struct GNUNET_GNSRECORD_PowP *pow)
 {
   const struct GNUNET_CRYPTO_PublicKey *pk;
@@ -264,7 +262,7 @@ GNUNET_GNSRECORD_check_pow (const struct 
GNUNET_GNSRECORD_PowP *pow,
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 sign_pow_identity (const struct GNUNET_CRYPTO_PrivateKey *key,
                    struct GNUNET_GNSRECORD_PowP *pow)
 {
@@ -273,6 +271,7 @@ sign_pow_identity (const struct GNUNET_CRYPTO_PrivateKey 
*key,
   const struct GNUNET_CRYPTO_PublicKey *pk;
   size_t ksize;
   char *sig;
+  enum GNUNET_GenericReturnValue result;
 
   /**
    * Predate the validity period to prevent rejections due to
@@ -285,9 +284,9 @@ sign_pow_identity (const struct GNUNET_CRYPTO_PrivateKey 
*key,
   pow->timestamp = GNUNET_TIME_absolute_hton (ts);
   rp = GNR_create_signature_message (pow);
   sig = ((char*) &pow[1]) + ksize;
-  int result = GNUNET_CRYPTO_sign_raw_ (key,
-                                        &rp->purpose,
-                                        (void*) sig);
+  result = GNUNET_CRYPTO_sign_raw_ (key,
+                                    &rp->purpose,
+                                    (void*) sig);
   GNUNET_free (rp);
   if (result == GNUNET_SYSERR)
     return GNUNET_NO;
@@ -296,7 +295,7 @@ sign_pow_identity (const struct GNUNET_CRYPTO_PrivateKey 
*key,
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 sign_pow (const struct GNUNET_CRYPTO_PrivateKey *key,
           struct GNUNET_GNSRECORD_PowP *pow)
 {
@@ -458,5 +457,3 @@ GNUNET_GNSRECORD_pow_stop (struct 
GNUNET_GNSRECORD_PowCalculationHandle *pc)
 {
   GNUNET_free (pc);
 }
-
-
diff --git a/src/lib/hello/hello-uri.c b/src/lib/hello/hello-uri.c
index 8bed16d21..5431ef61e 100644
--- a/src/lib/hello/hello-uri.c
+++ b/src/lib/hello/hello-uri.c
@@ -835,7 +835,7 @@ GNUNET_HELLO_builder_to_block (const struct 
GNUNET_HELLO_Builder *builder,
 }
 
 
-struct GNUNET_MQ_Envelope *
+static struct GNUNET_MQ_Envelope *
 GNUNET_HELLO_builder_to_env_ (const struct GNUNET_HELLO_Builder *builder,
                               const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
                               struct GNUNET_TIME_Relative expiration_time,
diff --git a/src/lib/util/scheduler.c b/src/lib/util/scheduler.c
index 038d2f6ac..3f3e1752a 100644
--- a/src/lib/util/scheduler.c
+++ b/src/lib/util/scheduler.c
@@ -25,7 +25,6 @@
 
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "disk.h"
 // DEBUG
 #include <inttypes.h>
 
@@ -473,7 +472,7 @@ check_priority (enum GNUNET_SCHEDULER_Priority p)
  * to tell the driver the next wakeup time (using its set_wakeup
  * callback)
  */
-struct GNUNET_TIME_Absolute
+static struct GNUNET_TIME_Absolute
 get_timeout ()
 {
   struct GNUNET_SCHEDULER_Task *pos;
@@ -793,7 +792,7 @@ GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p)
 }
 
 
-void
+static void
 init_fd_info (struct GNUNET_SCHEDULER_Task *t,
               const struct GNUNET_NETWORK_Handle *const *read_nh,
               unsigned int read_nh_len,
@@ -861,8 +860,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
     t->fds = fdi;
     t->read_fd = -1;
     t->write_fd = -1;
-    unsigned int i;
-    for (i = 0; i != read_nh_len; ++i)
+    for (int i = 0; i != read_nh_len; ++i)
     {
       fdi->fd = read_nh[i];
       GNUNET_assert (NULL != fdi->fd);
@@ -870,7 +868,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
       fdi->sock = GNUNET_NETWORK_get_fd (read_nh[i]);
       ++fdi;
     }
-    for (i = 0; i != write_nh_len; ++i)
+    for (int i = 0; i != write_nh_len; ++i)
     {
       fdi->fd = write_nh[i];
       GNUNET_assert (NULL != fdi->fd);
@@ -878,7 +876,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
       fdi->sock = GNUNET_NETWORK_get_fd (write_nh[i]);
       ++fdi;
     }
-    for (i = 0; i != read_fh_len; ++i)
+    for (int i = 0; i != read_fh_len; ++i)
     {
       fdi->fh = read_fh[i];
       GNUNET_assert (NULL != fdi->fh);
@@ -886,7 +884,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
       fdi->sock = (read_fh[i])->fd;     // FIXME: does not work under WIN32
       ++fdi;
     }
-    for (i = 0; i != write_fh_len; ++i)
+    for (int i = 0; i != write_fh_len; ++i)
     {
       fdi->fh = write_fh[i];
       GNUNET_assert (NULL != fdi->fh);
@@ -1750,7 +1748,7 @@ GNUNET_SCHEDULER_add_file_with_priority (struct 
GNUNET_TIME_Relative delay,
 }
 
 
-void
+static void
 extract_handles (const struct GNUNET_NETWORK_FDSet *fdset,
                  const struct GNUNET_NETWORK_Handle ***ntarget,
                  unsigned int *extracted_nhandles,
@@ -1849,10 +1847,6 @@ GNUNET_SCHEDULER_add_select (enum 
GNUNET_SCHEDULER_Priority prio,
   unsigned int write_nhandles_len = 0;
   unsigned int read_fhandles_len = 0;
   unsigned int write_fhandles_len = 0;
-
-  /* scheduler must be running */
-  GNUNET_assert (NULL != scheduler_driver);
-  GNUNET_assert (NULL != task);
   int no_rs = (NULL == rs);
   int no_ws = (NULL == ws);
   int empty_rs = (NULL != rs) && (0 == rs->nsds);
@@ -1861,6 +1855,11 @@ GNUNET_SCHEDULER_add_select (enum 
GNUNET_SCHEDULER_Priority prio,
                (empty_rs && empty_ws) ||
                (no_rs && empty_ws) ||
                (no_ws && empty_rs);
+  int no_fds_extracted;
+
+  /* scheduler must be running */
+  GNUNET_assert (NULL != scheduler_driver);
+  GNUNET_assert (NULL != task);
   if (! no_fds)
   {
     if (NULL != rs)
@@ -1886,10 +1885,11 @@ GNUNET_SCHEDULER_add_select (enum 
GNUNET_SCHEDULER_Priority prio,
    * this case gracefully because some libraries such as libmicrohttpd
    * only provide a hint what the maximum FD number in an FD set might be
    * and not the exact FD number (see e.g. gnunet-rest-service.c)
-   */int no_fds_extracted = (0 == read_nhandles_len) &&
-                         (0 == read_fhandles_len) &&
-                         (0 == write_nhandles_len) &&
-                         (0 == write_fhandles_len);
+   */
+  no_fds_extracted = (0 == read_nhandles_len) &&
+                     (0 == read_fhandles_len) &&
+                     (0 == write_nhandles_len) &&
+                     (0 == write_fhandles_len);
   if (no_fds || no_fds_extracted)
     return GNUNET_SCHEDULER_add_delayed_with_priority (delay,
                                                        prio,
@@ -2470,6 +2470,7 @@ select_add (void *cls,
             struct GNUNET_SCHEDULER_FdInfo *fdi)
 {
   struct DriverContext *context = cls;
+  struct Scheduled *scheduled;
 
   GNUNET_assert (NULL != context);
   GNUNET_assert (NULL != task);
@@ -2483,7 +2484,7 @@ select_add (void *cls,
     return GNUNET_SYSERR;
   }
 
-  struct Scheduled *scheduled = GNUNET_new (struct Scheduled);
+  scheduled = GNUNET_new (struct Scheduled);
   scheduled->task = task;
   scheduled->fdi = fdi;
   scheduled->et = fdi->et;
diff --git a/src/lib/util/strings.c b/src/lib/util/strings.c
index dc9fd0daf..456e3afb1 100644
--- a/src/lib/util/strings.c
+++ b/src/lib/util/strings.c
@@ -714,7 +714,7 @@ GNUNET_STRINGS_data_to_string (const void *data,
   /**
    * 32 characters for encoding
    */
-  static char *encTable__ = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
+  static const char *encTable__ = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
   unsigned int wpos;
   unsigned int rpos;
   unsigned int bits;
@@ -1613,9 +1613,9 @@ GNUNET_STRINGS_parse_ipv6_policy (const char *routeListX)
 /** ******************** Base64 encoding ***********/
 
 #define FILLCHAR '='
-static char *cvt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-                   "abcdefghijklmnopqrstuvwxyz"
-                   "0123456789+/";
+static const char *cvt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                         "abcdefghijklmnopqrstuvwxyz"
+                         "0123456789+/";
 
 
 size_t
@@ -1833,9 +1833,10 @@ GNUNET_STRINGS_urldecode (const char *data,
                           char **out)
 {
   const char *rpos = data;
-  *out = GNUNET_malloc (len + 1); /* output should always fit into input */
-  char *wpos = *out;
+  char *wpos;
   size_t resl = 0;
+  *out = GNUNET_malloc (len + 1); /* output should always fit into input */
+  wpos = *out;
 
   while ( ('\0' != *rpos) &&
           (data + len != rpos) )
diff --git a/src/service/core/gnunet-service-core_kx.c 
b/src/service/core/gnunet-service-core_kx.c
index 2dc9974bf..67f319529 100644
--- a/src/service/core/gnunet-service-core_kx.c
+++ b/src/service/core/gnunet-service-core_kx.c
@@ -2158,14 +2158,14 @@ GSC_KX_handle_client_monitor_peers (struct 
GNUNET_MQ_Handle *mq)
   GNUNET_notification_context_add (nc, mq);
   for (kx = kx_head; NULL != kx; kx = kx->next)
   {
-    struct GNUNET_MQ_Envelope *env;
+    struct GNUNET_MQ_Envelope *env_notify;
     struct MonitorNotifyMessage *msg;
 
-    env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY);
+    env_notify = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY);
     msg->state = htonl ((uint32_t) kx->status);
     msg->peer = *kx->peer;
     msg->timeout = GNUNET_TIME_absolute_hton (kx->timeout);
-    GNUNET_MQ_send (mq, env);
+    GNUNET_MQ_send (mq, env_notify);
   }
   env = GNUNET_MQ_msg (done_msg, GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY);
   done_msg->state = htonl ((uint32_t) GNUNET_CORE_KX_ITERATION_FINISHED);
diff --git a/src/service/gns/gnunet-dns2gns.c b/src/service/gns/gnunet-dns2gns.c
index 656ddd768..31e18c252 100644
--- a/src/service/gns/gnunet-dns2gns.c
+++ b/src/service/gns/gnunet-dns2gns.c
@@ -26,7 +26,6 @@
 #include <gnunet_util_lib.h>
 #include <gnunet_gns_service.h>
 #include "gnunet_vpn_service.h"
-#include "gns.h"
 
 /**
  * Timeout for DNS requests.
@@ -400,7 +399,7 @@ dns_result_processor (void *cls,
 static void
 vpn_allocation_cb (void *cls,
                    int af,
-                   const void *address)
+                   const void *vaddress)
 {
   struct VpnContext *vpn_ctx = cls;
   struct Request *request = vpn_ctx->request;
@@ -427,7 +426,7 @@ vpn_allocation_cb (void *cls,
         rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (
           VPN_TIMEOUT).abs_value_us;
         rd[i].flags = 0;
-        rd[i].data = address;
+        rd[i].data = vaddress;
         break;
 
       case AF_INET6:
@@ -435,7 +434,7 @@ vpn_allocation_cb (void *cls,
         rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (
           VPN_TIMEOUT).abs_value_us;
         rd[i].flags = 0;
-        rd[i].data = address;
+        rd[i].data = vaddress;
         rd[i].data_size = sizeof(struct in6_addr);
         break;
 
diff --git a/src/service/gns/gnunet-gns-proxy.c 
b/src/service/gns/gnunet-gns-proxy.c
index b38f0a425..e2ebcd38d 100644
--- a/src/service/gns/gnunet-gns-proxy.c
+++ b/src/service/gns/gnunet-gns-proxy.c
@@ -41,8 +41,6 @@
 #include <regex.h>
 #include "gnunet_util_lib.h"
 #include "gnunet_gns_service.h"
-#include "gnunet_identity_service.h"
-#include "gns.h"
 #include "gnunet_mhd_compat.h"
 
 /**
@@ -1846,7 +1844,7 @@ create_response (void *cls,
   const struct sockaddr *sa;
   const struct sockaddr_in *s4;
   const struct sockaddr_in6 *s6;
-  uint16_t port;
+  uint16_t port_tmp;
   size_t left;
 
   if (NULL == s5r)
@@ -1878,7 +1876,7 @@ create_response (void *cls,
                          sizeof(ipaddr),
                          "%s",
                          ipstring);
-        port = ntohs (s4->sin_port);
+        port_tmp = ntohs (s4->sin_port);
         break;
 
       case AF_INET6:
@@ -1895,7 +1893,7 @@ create_response (void *cls,
                          sizeof(ipaddr),
                          "%s",
                          ipstring);
-        port = ntohs (s6->sin6_port);
+        port_tmp = ntohs (s6->sin6_port);
         break;
 
       default:
@@ -1905,7 +1903,7 @@ create_response (void *cls,
       GNUNET_asprintf (&curl_hosts,
                        "%s:%d:%s",
                        s5r->leho,
-                       port,
+                       port_tmp,
                        ipaddr);
       s5r->hosts = curl_slist_append (NULL,
                                       curl_hosts);
@@ -1913,7 +1911,7 @@ create_response (void *cls,
     }
     else
     {
-      port = s5r->port;
+      port_tmp = s5r->port;
     }
     if (NULL == s5r->curl)
       s5r->curl = curl_easy_init ();
@@ -1976,7 +1974,7 @@ create_response (void *cls,
                        (NULL != s5r->leho)
                        ? s5r->leho
                        : ipaddr,
-                       port,
+                       port_tmp,
                        s5r->url);
     }
     else
@@ -1986,7 +1984,7 @@ create_response (void *cls,
                        ? "http://%s:%d%s";
                        : "https://%s:%d%s";,
                        s5r->domain,
-                       port,
+                       port_tmp,
                        s5r->url);
     }
     curl_easy_setopt (s5r->curl,
@@ -3308,10 +3306,10 @@ do_s5r_read (void *cls)
     case SOCKS5_AT_IPV4:
       {
         const struct in_addr *v4 = (const struct in_addr *) &c_req[1];
-        const uint16_t *port = (const uint16_t *) &v4[1];
+        const uint16_t *v4port = (const uint16_t *) &v4[1];
         struct sockaddr_in *in;
 
-        s5r->port = ntohs (*port);
+        s5r->port = ntohs (*v4port);
         alen = sizeof(struct in_addr);
         if (s5r->rbuf_len < sizeof(struct Socks5ClientRequestMessage)
             + alen + sizeof(uint16_t))
@@ -3319,7 +3317,7 @@ do_s5r_read (void *cls)
         in = (struct sockaddr_in *) &s5r->destination_address;
         in->sin_family = AF_INET;
         in->sin_addr = *v4;
-        in->sin_port = *port;
+        in->sin_port = *v4port;
 #if HAVE_SOCKADDR_IN_SIN_LEN
         in->sin_len = sizeof(*in);
 #endif
@@ -3330,10 +3328,10 @@ do_s5r_read (void *cls)
     case SOCKS5_AT_IPV6:
       {
         const struct in6_addr *v6 = (const struct in6_addr *) &c_req[1];
-        const uint16_t *port = (const uint16_t *) &v6[1];
+        const uint16_t *v6port = (const uint16_t *) &v6[1];
         struct sockaddr_in6 *in;
 
-        s5r->port = ntohs (*port);
+        s5r->port = ntohs (*v6port);
         alen = sizeof(struct in6_addr);
         if (s5r->rbuf_len < sizeof(struct Socks5ClientRequestMessage)
             + alen + sizeof(uint16_t))
@@ -3341,7 +3339,7 @@ do_s5r_read (void *cls)
         in = (struct sockaddr_in6 *) &s5r->destination_address;
         in->sin6_family = AF_INET6;
         in->sin6_addr = *v6;
-        in->sin6_port = *port;
+        in->sin6_port = *v6port;
 #if HAVE_SOCKADDR_IN_SIN_LEN
         in->sin6_len = sizeof(*in);
 #endif
@@ -3353,7 +3351,7 @@ do_s5r_read (void *cls)
       {
         const uint8_t *dom_len;
         const char *dom_name;
-        const uint16_t *port;
+        const uint16_t *dport;
 
         dom_len = (const uint8_t *) &c_req[1];
         alen = *dom_len + 1;
@@ -3361,16 +3359,16 @@ do_s5r_read (void *cls)
             + alen + sizeof(uint16_t))
           return;     /* need more data */
         dom_name = (const char *) &dom_len[1];
-        port = (const uint16_t *) &dom_name[*dom_len];
+        dport = (const uint16_t *) &dom_name[*dom_len];
         s5r->domain = GNUNET_strndup (dom_name,
                                       *dom_len);
         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                     "Requested connection is to %s:%d\n",
                     // (HTTPS_PORT == s5r->port) ? "s" : "",
                     s5r->domain,
-                    ntohs (*port));
+                    ntohs (*dport));
         s5r->state = SOCKS5_RESOLVING;
-        s5r->port = ntohs (*port);
+        s5r->port = ntohs (*dport);
         s5r->is_tls = (HTTPS_PORT == s5r->port) ? GNUNET_YES : GNUNET_NO;
         s5r->gns_lookup = GNUNET_GNS_lookup_with_tld (gns_handle,
                                                       s5r->domain,
diff --git a/src/service/gns/gnunet-service-gns_resolver.c 
b/src/service/gns/gnunet-service-gns_resolver.c
index b14500ab7..fbffee9d0 100644
--- a/src/service/gns/gnunet-service-gns_resolver.c
+++ b/src/service/gns/gnunet-service-gns_resolver.c
@@ -42,11 +42,9 @@
 #include "gnunet_dht_service.h"
 #include "gnunet_gnsrecord_lib.h"
 #include "gnunet_namecache_service.h"
-#include "gnunet_dns_service.h"
 #include "gnunet_resolver_service.h"
 #include "gnunet_revocation_service.h"
 #include "gnunet_gns_service.h"
-#include "gns.h"
 #include "gnunet-service-gns.h"
 #include "gnunet-service-gns_resolver.h"
 #include "gnu_name_system_protocols.h"
@@ -57,13 +55,13 @@
  * Default DHT timeout for lookups.
  */
 #define DHT_LOOKUP_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 60)
+          GNUNET_TIME_UNIT_SECONDS, 60)
 
 /**
  * Default timeout for DNS lookups.
  */
 #define DNS_LOOKUP_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 15)
+          GNUNET_TIME_UNIT_SECONDS, 15)
 
 /**
  * DHT replication level
@@ -486,7 +484,8 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
  * @param name the name to test
  * @return #GNUNET_YES if canonical
  */
-/* dead, but keep for now */ int
+/* dead, but keep for now */
+static int
 is_canonical (const char *name)
 {
   const char *pos;
@@ -2104,27 +2103,27 @@ handle_gns_resolution_result (void *cls,
 
       case GNUNET_DNSPARSER_TYPE_CNAME:
         {
-          char *cname;
+          char *cname_tmp;
 
           off = 0;
-          cname = GNUNET_DNSPARSER_parse_name (rd[i].data,
-                                               rd[i].data_size,
-                                               &off);
-          if ((NULL == cname) ||
+          cname_tmp = GNUNET_DNSPARSER_parse_name (rd[i].data,
+                                                   rd[i].data_size,
+                                                   &off);
+          if ((NULL == cname_tmp) ||
               (off != rd[i].data_size))
           {
             GNUNET_break_op (0);      /* record not well-formed */
           }
           else
           {
-            cname = translate_dot_plus (rh, cname);
-            GNUNET_break (NULL != cname);
+            cname_tmp = translate_dot_plus (rh, cname_tmp);
+            GNUNET_break (NULL != cname_tmp);
             scratch_start = scratch_off;
             if (GNUNET_OK !=
                 GNUNET_DNSPARSER_builder_add_name (scratch,
                                                    sizeof(scratch),
                                                    &scratch_off,
-                                                   cname))
+                                                   cname_tmp))
             {
               GNUNET_break (0);
             }
@@ -2136,7 +2135,7 @@ handle_gns_resolution_result (void *cls,
               rd_off++;
             }
           }
-          GNUNET_free (cname);
+          GNUNET_free (cname_tmp);
         }
         break;
 
@@ -2393,13 +2392,14 @@ handle_gns_resolution_result (void *cls,
               (rd[i].data_size >= sizeof(struct GNUNET_GNSRECORD_SBoxRecord)))
           {
             const struct GNUNET_GNSRECORD_SBoxRecord *box;
+            const char *prefix;
+            size_t prefix_len;
 
             box = rd[i].data;
-            const char *prefix = rd[i].data + sizeof(struct
-                                                     
GNUNET_GNSRECORD_SBoxRecord);
-            size_t prefix_len = strnlen (prefix, rd[i].data_size - 
sizeof(struct
-                                                                          
GNUNET_GNSRECORD_SBoxRecord))
-                                + 1;
+            prefix = rd[i].data + sizeof(struct GNUNET_GNSRECORD_SBoxRecord);
+            prefix_len = strnlen (
+              prefix,
+              rd[i].data_size - sizeof(struct GNUNET_GNSRECORD_SBoxRecord)) + 
1;
             if (prefix_len - 1 >= rd[i].data_size - sizeof(struct
                                                            
GNUNET_GNSRECORD_SBoxRecord))
             {
diff --git a/src/service/namestore/namestore_api.c 
b/src/service/namestore/namestore_api.c
index d283eb4b9..cb6cc18fc 100644
--- a/src/service/namestore/namestore_api.c
+++ b/src/service/namestore/namestore_api.c
@@ -1222,7 +1222,7 @@ GNUNET_NAMESTORE_records_store (
                                              &msg[1],
                                              key_len);
   rd_set = (struct RecordSet*) (((char*) &msg[1]) + key_len);
-  for (int i = 0; i < *rds_sent; i++)
+  for (i = 0; i < *rds_sent; i++)
   {
     label = record_info[i].a_label;
     rd = record_info[i].a_rd;
diff --git a/src/service/reclaim/reclaim_credential.c 
b/src/service/reclaim/reclaim_credential.c
index b89f23f90..082638866 100644
--- a/src/service/reclaim/reclaim_credential.c
+++ b/src/service/reclaim/reclaim_credential.c
@@ -364,7 +364,7 @@ GNUNET_RECLAIM_credential_list_deserialize (const char 
*data, size_t data_size)
  * @param attrs claim list to copy
  * @return copied claim list
  */
-struct GNUNET_RECLAIM_CredentialList *
+static struct GNUNET_RECLAIM_CredentialList *
 GNUNET_RECLAIM_credential_list_dup (
   const struct GNUNET_RECLAIM_CredentialList *al)
 {
@@ -572,7 +572,7 @@ GNUNET_RECLAIM_credential_get_expiration (const struct
  * @param typename name to convert
  * @return corresponding number, UINT32_MAX on error
  */
-uint32_t
+static uint32_t
 GNUNET_RECLAIM_presentation_typename_to_number (const char *typename)
 {
   unsigned int i;
@@ -787,7 +787,7 @@ GNUNET_RECLAIM_presentation_list_deserialize (const char 
*data, size_t
  * @param attrs claim list to copy
  * @return copied claim list
  */
-struct GNUNET_RECLAIM_PresentationList *
+static struct GNUNET_RECLAIM_PresentationList *
 GNUNET_RECLAIM_presentation_list_dup (
   const struct GNUNET_RECLAIM_PresentationList *al)
 {
diff --git a/src/service/rest/gnunet-rest-server.c 
b/src/service/rest/gnunet-rest-server.c
index d71f8d352..f8fd7cefc 100644
--- a/src/service/rest/gnunet-rest-server.c
+++ b/src/service/rest/gnunet-rest-server.c
@@ -1383,47 +1383,47 @@ run (void *cls,
   }
   /* Load plugins */
   // FIXME: Use per-plugin rest plugin structs
-  struct GNUNET_REST_Plugin *config_plugin = REST_config_init (cfg);
+  config_plugin = REST_config_init (cfg);
   if (GNUNET_OK != setup_plugin (config_plugin->name,
                                  &REST_config_process_request, config_plugin))
   {
     GNUNET_SCHEDULER_shutdown ();
   }
-  struct GNUNET_REST_Plugin *copying_plugin = REST_copying_init (cfg);
+  copying_plugin = REST_copying_init (cfg);
   if (GNUNET_OK != setup_plugin (copying_plugin->name,
                                  &REST_copying_process_request, 
copying_plugin))
   {
     GNUNET_SCHEDULER_shutdown ();
   }
-  struct GNUNET_REST_Plugin *identity_plugin = REST_identity_init (cfg);
+  identity_plugin = REST_identity_init (cfg);
   if (GNUNET_OK != setup_plugin (identity_plugin->name,
                                  &REST_identity_process_request,
                                  identity_plugin))
   {
     GNUNET_SCHEDULER_shutdown ();
   }
-  struct GNUNET_REST_Plugin *namestore_plugin = REST_namestore_init (cfg);
+  namestore_plugin = REST_namestore_init (cfg);
   if (GNUNET_OK != setup_plugin (namestore_plugin->name,
                                  &REST_namestore_process_request,
                                  namestore_plugin))
   {
     GNUNET_SCHEDULER_shutdown ();
   }
-  struct GNUNET_REST_Plugin *gns_plugin = REST_gns_init (cfg);
+  gns_plugin = REST_gns_init (cfg);
   if (GNUNET_OK != setup_plugin (gns_plugin->name, &REST_gns_process_request,
                                  gns_plugin))
   {
     GNUNET_SCHEDULER_shutdown ();
   }
 #if HAVE_JOSE
-  struct GNUNET_REST_Plugin *openid_plugin = REST_openid_init (cfg);
+  openid_plugin = REST_openid_init (cfg);
   if (GNUNET_OK != setup_plugin (openid_plugin->name,
                                  &REST_openid_process_request, openid_plugin))
   {
     GNUNET_SCHEDULER_shutdown ();
   }
 #endif
-  struct GNUNET_REST_Plugin *reclaim_plugin = REST_reclaim_init (cfg);
+  reclaim_plugin = REST_reclaim_init (cfg);
   if (GNUNET_OK != setup_plugin (reclaim_plugin->name,
                                  &REST_reclaim_process_request, 
reclaim_plugin))
   {
diff --git a/src/service/util/gnunet-service-resolver.c 
b/src/service/util/gnunet-service-resolver.c
index 8d57738ed..6ff751cef 100644
--- a/src/service/util/gnunet-service-resolver.c
+++ b/src/service/util/gnunet-service-resolver.c
@@ -27,7 +27,6 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_protocols.h"
-#include "gnunet_statistics_service.h"
 #include "../../lib/util/resolver.h"
 
 
@@ -649,9 +648,9 @@ try_cache (const char *hostname,
     if ((GNUNET_DNSPARSER_TYPE_CNAME == record->type) &&
         (GNUNET_DNSPARSER_TYPE_CNAME != record_type) && (GNUNET_NO == found))
     {
-      const char *hostname = record->data.hostname;
+      const char *hostname_tmp = record->data.hostname;
 
-      process_get (hostname, record_type, client_request_id, client);
+      process_get (hostname_tmp, record_type, client_request_id, client);
       return GNUNET_YES;     /* counts as a cache "hit" */
     }
     if (0 == strcmp (record->name, hostname))
@@ -1369,7 +1368,7 @@ GNUNET_SERVICE_MAIN (
 /**
  * MINIMIZE heap size (way below 128k) since this process doesn't need much.
  */
-void __attribute__ ((constructor))
+static void __attribute__ ((constructor))
 GNUNET_RESOLVER_memory_init ()
 {
   mallopt (M_TRIM_THRESHOLD, 4 * 1024);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]