]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/valgrind/src/valgrind-3.6.0-svn/drd/drd_bitmap2_node.c
update
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / drd / drd_bitmap2_node.c
index 9dc3ef5629e21b2baf3942c752256936bb46de15..3b21dd27985209d2e9aa72fb2b4cc1fa9bdbe008 100644 (file)
@@ -1,8 +1,8 @@
-/* -*- mode: C; c-basic-offset: 3; -*- */
+/* -*- mode: C; c-basic-offset: 3; indent-tabs-mode: nil; -*- */
 /*
   This file is part of drd, a thread error detector.
 
-  Copyright (C) 2006-2010 Bart Van Assche <bart.vanassche@gmail.com>.
+  Copyright (C) 2006-2011 Bart Van Assche <bvanassche@acm.org>.
 
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
@@ -154,24 +154,22 @@ void  DRD_(bm2_free_node)(void* const bm2)
 {
    struct block_allocator_chunk* p;
 
-   tl_assert(s_bm2_node_size > 0);
    tl_assert(bm2);
 
-   for (p = s_first; p; p = p->next)
-   {
-      if (p->data <= bm2 && bm2 < p->data_end)
-      {
-        /* Free the memory that was allocated for a non-root AVL tree node. */
-         tl_assert(((char*)bm2 - (char*)(p->data)) % s_bm2_node_size == 0);
-         *(void**)bm2 = p->first_free;
-         p->first_free = bm2;
-         tl_assert(p->nallocated >= 1);
-         if (--(p->nallocated) == 0)
-            free_chunk(p);
-         return;
+   if (s_bm2_node_size > 0) {
+      for (p = s_first; p; p = p->next) {
+        if (p->data <= bm2 && bm2 < p->data_end) {
+           /* Free a non-root AVL tree node. */
+           tl_assert(((char*)bm2 - (char*)(p->data)) % s_bm2_node_size == 0);
+           *(void**)bm2 = p->first_free;
+           p->first_free = bm2;
+           tl_assert(p->nallocated >= 1);
+           if (--(p->nallocated) == 0)
+              free_chunk(p);
+           return;
+        }
       }
    }
-
    /* Free the memory that was allocated for an AVL tree root node. */
    VG_(free)(bm2);
 }