Bug 807883: Add 'const' to the 'pool' parameter and 'arena' local variable NSPR_4_9_6_BETA2
authorwtc%google.com
Mon, 11 Feb 2013 15:36:33 +0000
changeset 4440 6cf2b626385389b1f9706a632af1fababfa78a2f
parent 4439 92da3e137baa1e1d33be66596737849e1bcf263c
child 4446 1596e546b98c99d6e960f3bec71f7e9b1db6d577
push idunknown
push userunknown
push dateunknown
bugs807883
Bug 807883: Add 'const' to the 'pool' parameter and 'arena' local variable of PL_SizeOfArenaPoolExcludingPool. Fix comments. r=n.nethercote. Modified Files: plarena.c plarenas.h
lib/ds/plarena.c
lib/ds/plarenas.h
--- a/lib/ds/plarena.c
+++ b/lib/ds/plarena.c
@@ -341,24 +341,24 @@ PR_IMPLEMENT(void) PL_ArenaFinish(void)
     if (arenaLock) {
         PR_DestroyLock(arenaLock);
         arenaLock = NULL;
     }
     once = pristineCallOnce;
 }
 
 PR_IMPLEMENT(size_t) PL_SizeOfArenaPoolExcludingPool(
-    PLArenaPool *pool, PLMallocSizeFn mallocSizeOf)
+    const PLArenaPool *pool, PLMallocSizeFn mallocSizeOf)
 {
     /*
      * The first PLArena is within |pool|, so don't measure it.  Subsequent
-     * PLArenas are separate and must measured.
+     * PLArenas are separate and must be measured.
      */
     size_t size = 0;
-    PLArena *arena = pool->first.next;
+    const PLArena *arena = pool->first.next;
     while (arena) {
         size += mallocSizeOf(arena);
         arena = arena->next;
     }
     return size;
 }
 
 #ifdef PL_ARENAMETER
--- a/lib/ds/plarenas.h
+++ b/lib/ds/plarenas.h
@@ -56,23 +56,23 @@ PR_EXTERN(void *) PL_ArenaGrow(
 PR_EXTERN(void) PL_ArenaRelease(PLArenaPool *pool, char *mark);
 
 /*
 ** memset contents of all arenas in pool to pattern
 */
 PR_EXTERN(void) PL_ClearArenaPool(PLArenaPool *pool, PRInt32 pattern);
 
 /*
-** A function like malloc_size() or malloc_usable_size() that returns the
+** A function like malloc_size() or malloc_usable_size() that measures the
 ** size of a heap block.
 */
 typedef size_t (*PLMallocSizeFn)(const void *ptr);
 
 /*
-** Return all memory used by a PLArenaPool, excluding the PLArenaPool
+** Measure all memory used by a PLArenaPool, excluding the PLArenaPool
 ** structure.
 */
 PR_EXTERN(size_t) PL_SizeOfArenaPoolExcludingPool(
-    PLArenaPool *pool, PLMallocSizeFn mallocSizeOf);
+    const PLArenaPool *pool, PLMallocSizeFn mallocSizeOf);
 
 PR_END_EXTERN_C
 
 #endif /* PLARENAS_H */