]> sourceware.org Git - lvm2.git/commitdiff
Simplify some pointer operations
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 20 Oct 2011 13:33:41 +0000 (13:33 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 20 Oct 2011 13:33:41 +0000 (13:33 +0000)
WHATS_NEW_DM
libdm/mm/dbg_malloc.c

index 06ceb0ae0716690e79fc375c3ca68710262c6e28..75edc90201215812b80299ddcfc7dfa671dcf042 100644 (file)
@@ -1,5 +1,6 @@
 Version 1.02.68 -
 ==================================
+  Simplify some pointer operations in dm_free_aux() debug code..
   Remove unused dbg_malloc.h file from source tree.
   Cleanup backtraces for _create_and_load_v4().
   Fix alignment warning in bitcount calculation for raid segment.
index db7f5f3ed77b21ffbfa34deffc9f38521edce036..cf8330cf48102d2fc0ad767df185e4a3cb66be50 100644 (file)
@@ -143,9 +143,9 @@ void dm_free_aux(void *p)
        assert(mb->magic == p);
 
        /* check data at the far boundary */
-       ptr = ((char *) mb) + sizeof(struct memblock) + mb->length;
+       ptr = (char *) p + mb->length;
        for (i = 0; i < sizeof(unsigned long); i++)
-               if (*ptr++ != (char) mb->id)
+               if (ptr[i] != (char) mb->id)
                        assert(!"Damage at far end of block");
 
        /* have we freed this before ? */
@@ -165,9 +165,9 @@ void dm_free_aux(void *p)
        mb->id = 0;
 
        /* stomp a different pattern across the memory */
-       ptr = ((char *) mb) + sizeof(struct memblock);
+       ptr = p;
        for (i = 0; i < mb->length; i++)
-               *ptr++ = i & 1 ? (char) 0xde : (char) 0xad;
+               ptr[i] = i & 1 ? (char) 0xde : (char) 0xad;
 
        assert(_mem_stats.blocks_allocated);
        _mem_stats.blocks_allocated--;
This page took 0.034799 seconds and 5 git commands to generate.