[Olsr-dev] [PATCH 11/12] olsr_cookie: introduce OLSR_COOKIE_DEBUG define

Ferry Huberts (spam-protected)
Thu Jun 9 13:42:57 CEST 2011


From: Ferry Huberts <(spam-protected)>

src/olsr_cookie.c:213:9: error: variable ‘reuse’ set but not used [-Werror=unused-but-set-variable]
src/olsr_cookie.c:273:9: error: variable ‘reuse’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/olsr_cookie.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/olsr_cookie.c b/src/olsr_cookie.c
index bee2a5d..7cb1c90 100644
--- a/src/olsr_cookie.c
+++ b/src/olsr_cookie.c
@@ -210,7 +210,10 @@ olsr_cookie_malloc(struct olsr_cookie_info *ci)
   void *ptr;
   struct olsr_cookie_mem_brand *branding;
   struct list_node *free_list_node;
+
+#ifdef OLSR_COOKIE_DEBUG
   bool reuse = false;
+#endif
 
   /*
    * Check first if we have reusable memory.
@@ -239,7 +242,9 @@ olsr_cookie_malloc(struct olsr_cookie_info *ci)
     ptr = (void *)free_list_node;
     memset(ptr, 0, ci->ci_size);
     ci->ci_free_list_usage--;
+#ifdef OLSR_COOKIE_DEBUG
     reuse = true;
+#endif
   }
 
   /*
@@ -254,7 +259,7 @@ olsr_cookie_malloc(struct olsr_cookie_info *ci)
   /* Stats keeping */
   olsr_cookie_usage_incr(ci->ci_id);
 
-#if 0
+#ifdef OLSR_COOKIE_DEBUG
   OLSR_PRINTF(1, "MEMORY: alloc %s, %p, %u bytes%s\n", ci->ci_name, ptr, ci->ci_size, reuse ? ", reuse" : "");
 #endif
 
@@ -270,7 +275,10 @@ olsr_cookie_free(struct olsr_cookie_info *ci, void *ptr)
 {
   struct olsr_cookie_mem_brand *branding;
   struct list_node *free_list_node;
+
+#ifdef OLSR_COOKIE_DEBUG
   bool reuse = false;
+#endif
 
   branding = (struct olsr_cookie_mem_brand *)ARM_NOWARN_ALIGN(((unsigned char *)ptr + ci->ci_size));
 
@@ -294,8 +302,9 @@ olsr_cookie_free(struct olsr_cookie_info *ci, void *ptr)
     list_node_init(free_list_node);
     list_add_before(&ci->ci_free_list, free_list_node);
     ci->ci_free_list_usage++;
+#ifdef OLSR_COOKIE_DEBUG
     reuse = true;
-
+#endif
   } else {
 
     /*
@@ -307,7 +316,7 @@ olsr_cookie_free(struct olsr_cookie_info *ci, void *ptr)
   /* Stats keeping */
   olsr_cookie_usage_decr(ci->ci_id);
 
-#if 0
+#ifdef OLSR_COOKIE_DEBUG
   OLSR_PRINTF(1, "MEMORY: free %s, %p, %u bytes%s\n", ci->ci_name, ptr, ci->ci_size, reuse ? ", reuse" : "");
 #endif
 
-- 
1.7.5.2





More information about the Olsr-dev mailing list