# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16858]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=16858 >


Oops, this should have been combined with the previous dod.c patch.
It's the same thing -- minor refactoring for clarity, plus fixing
BUFFER_external_FLAG. But applying either individually won't break
anything that's not already broken.


-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/36050/29175/342e17/resources-nits.patch

Index: resources.c
===================================================================
RCS file: /cvs/public/parrot/resources.c,v
retrieving revision 1.84
diff -p -u -r1.84 resources.c
--- resources.c 24 Aug 2002 05:31:20 -0000      1.84
+++ resources.c 29 Aug 2002 20:20:32 -0000
@@ -143,6 +143,16 @@ mem_allocate(struct Parrot_Interp *inter
 
 /** Compaction Code **/
 
+static int
+buffer_movable(UINTVAL flags)
+{
+    UINTVAL mask = BUFFER_on_free_list_FLAG
+                 | BUFFER_constant_FLAG
+                 | BUFFER_immobile_FLAG
+                 | BUFFER_external_FLAG;
+    return !(flags & mask);
+}
+
 /* Compact the buffer pool */
 static void compact_pool(struct Parrot_Interp *interpreter,
                          struct Memory_Pool *pool)
@@ -203,12 +213,7 @@ static void compact_pool(struct Parrot_I
             Buffer *b = cur_buffer_arena->start_objects;
             UINTVAL i;
             for (i = 0; i < cur_buffer_arena->used; i++) {
-                if (b->bufstart && 
-                    !(b->flags & ( BUFFER_on_free_list_FLAG
-                                 | BUFFER_constant_FLAG
-                                 | BUFFER_immobile_FLAG
-                                 | BUFFER_external_FLAG
-                                 ))) {
+                if (b->bufstart && buffer_movable(b->flags)) {
                     struct Buffer_Tail *tail = 
                         (struct Buffer_Tail *)((char *)b->bufstart +b->buflen);
                     ptrdiff_t offset = 0;
@@ -285,10 +290,7 @@ static void compact_pool(struct Parrot_I
             interpreter->arena_base->extra_buffer_headers.bufstart;
         Buffer* b = buffers[j];
         if (b->bufstart) {
-            if (!(b->flags & (BUFFER_on_free_list_FLAG | 
-                              BUFFER_constant_FLAG | 
-                              BUFFER_immobile_FLAG)))
-            {
+            if (buffer_movable(b->flags)) {
                 struct Buffer_Tail *new_tail = 
                        (struct Buffer_Tail *)((char *)cur_spot + b->buflen);
                 /* we can't perform the math all the time, 

Reply via email to