Author: petdance
Date: Sat Jun  9 16:39:43 2007
New Revision: 18897

Modified:
   trunk/include/parrot/list.h
   trunk/src/gc/dod.c
   trunk/src/list.c

Log:
adding NN flags all around

Modified: trunk/include/parrot/list.h
==============================================================================
--- trunk/include/parrot/list.h (original)
+++ trunk/include/parrot/list.h Sat Jun  9 16:39:43 2007
@@ -121,7 +121,8 @@
         __attribute__pure__
         __attribute__warn_unused_result__;
 
-PARROT_API void list_mark( Interp *interp, List *list /*NN*/ )
+PARROT_API void list_mark( Interp *interp /*NN*/, List *list /*NN*/ )
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
 PARROT_API List * list_new( Interp *interp, INTVAL type )
@@ -172,7 +173,9 @@
     int type )
         __attribute__nonnull__(2);
 
-PARROT_API void list_visit( Interp *interp, List *list, void *pinfo );
+PARROT_API void list_visit( Interp *interp, List *list /*NN*/, void *pinfo )
+        __attribute__nonnull__(2);
+
 /* HEADERIZER END: src/list.c */
 
 #endif /* PARROT_LIST_H_GUARD */

Modified: trunk/src/gc/dod.c
==============================================================================
--- trunk/src/gc/dod.c  (original)
+++ trunk/src/gc/dod.c  Sat Jun  9 16:39:43 2007
@@ -38,7 +38,8 @@
 #endif
 
 static size_t find_common_mask(size_t val1, size_t val2)
-    __attribute__pure__;
+    __attribute__const__
+    __attribute__warn_unused_result__;
 
 /*
 
@@ -313,7 +314,7 @@
 */
 
 static int
-trace_active_PMCs(Interp *interp, int trace_stack)
+trace_active_PMCs(Interp *interp /*NN*/, int trace_stack)
 {
     if (!Parrot_dod_trace_root(interp, trace_stack))
         return 0;
@@ -332,7 +333,7 @@
 */
 
 int
-Parrot_dod_trace_children(Interp *interp, size_t how_many)
+Parrot_dod_trace_children(Interp *interp /*NN*/, size_t how_many)
 {
     Arenas * const arena_base = interp->arena_base;
     const int     lazy_dod    = arena_base->lazy_dod;
@@ -787,7 +788,7 @@
 
 /* interp is unused and can be removed */
 static void
-clear_live_bits(Interp *interp /*NULLOK*/, Small_Object_Pool * const pool)
+clear_live_bits(Interp *interp /*NULLOK*/, Small_Object_Pool *pool /*NN*/)
 {
     Small_Object_Arena *arena;
     const UINTVAL       object_size = pool->object_size;

Modified: trunk/src/list.c
==============================================================================
--- trunk/src/list.c    (original)
+++ trunk/src/list.c    Sat Jun  9 16:39:43 2007
@@ -669,7 +669,7 @@
 */
 
 static List_chunk *
-add_chunk(Interp *interp, List *list /*NN*/, int where, UINTVAL idx)
+add_chunk(Interp *interp /*NN*/, List *list /*NN*/, int where, UINTVAL idx)
 {
     List_chunk * const chunk = where ? list->last : list->first;
     List_chunk * const new_chunk = alloc_next_size(interp, list, where, idx);
@@ -1082,7 +1082,7 @@
 */
 
 static void
-list_append(Interp *interp, List *list /*NN*/, void *item, int type, UINTVAL 
idx)
+list_append(Interp *interp /*NN*/, List *list /*NN*/, void *item, int type, 
UINTVAL idx)
 {
     /* initially, list may be empty, also used by assign */
     while (idx >= list->cap)
@@ -1196,20 +1196,16 @@
         const INTVAL val = i + 1;
         switch (key) {
             case 0:
-                size = VTABLE_get_integer_keyed_int(interp,
-                        init, val);
+                size = VTABLE_get_integer_keyed_int(interp, init, val);
                 break;
             case 1:
-                multi_key = VTABLE_get_pmc_keyed_int(interp,
-                        init, val);
+                multi_key = VTABLE_get_pmc_keyed_int(interp, init, val);
                 break;
             case 2:
-                type = VTABLE_get_integer_keyed_int(interp,
-                        init, val);
+                type = VTABLE_get_integer_keyed_int(interp, init, val);
                 break;
             case 3:
-                item_size = VTABLE_get_integer_keyed_int(interp,
-                        init, val);
+                item_size = VTABLE_get_integer_keyed_int(interp, init, val);
                 break;
             case 4:
                 items_per_chunk = VTABLE_get_integer_keyed_int(
@@ -1222,13 +1218,10 @@
         if (!item_size)
             internal_exception(1, "No item_size for type_sized list\n");
         list->item_size = item_size;
-        if (items_per_chunk) {
-            /* make power of 2 */
-            items_per_chunk = 1 << (ld(items_per_chunk) + 1);
-            list->items_per_chunk = items_per_chunk;
-        }
-        else
-            list->items_per_chunk = MAX_ITEMS;
+        list->items_per_chunk =
+            items_per_chunk
+                ? (1 << (ld(items_per_chunk) + 1)) /* make power of 2 */
+                : MAX_ITEMS;
     }
     if (size)
         list_set_length(interp, list, size);
@@ -1348,7 +1341,7 @@
 
 PARROT_API
 void
-list_mark(Interp *interp, List *list /*NN*/)
+list_mark(Interp *interp /*NN*/, List *list /*NN*/)
 {
     List_chunk *chunk;
 
@@ -1385,7 +1378,7 @@
 
 PARROT_API
 void
-list_visit(Interp *interp, List *list, void *pinfo)
+list_visit(Interp *interp, List *list /*NN*/, void *pinfo)
 {
     List_chunk *chunk;
     visit_info * const info = (visit_info*) pinfo;
@@ -1438,12 +1431,10 @@
 void
 list_set_length(Interp *interp, List *list /*NN*/, INTVAL len)
 {
-    UINTVAL idx;
-
     if (len < 0)
         len += list->length;
     if (len >= 0) {
-        idx = list->start + (UINTVAL)len;
+        const UINTVAL idx = list->start + (UINTVAL)len;
         list->length = len;
         if (idx >= list->cap) {
             /* assume user will fill it, so don't generate sparse
@@ -1476,9 +1467,7 @@
 void
 list_insert(Interp *interp, List *list /*NN*/, INTVAL idx, INTVAL n_items)
 {
-    List_chunk *chunk, *new_chunk, *rest;
-
-    INTVAL items;
+    List_chunk *chunk;
 
     assert(idx >= 0);
     idx += list->start;
@@ -1500,6 +1489,9 @@
     if (chunk->flags & sparse)
         chunk->items += n_items;
     else {
+        List_chunk *new_chunk;
+        INTVAL items;
+
         /* 1. cut this chunk at idx */
         list->grow_policy = enum_grow_mixed;
         /* allocate a sparse chunk, n_items big */
@@ -1508,6 +1500,8 @@
         new_chunk->flags |= sparse;
         items = chunk->items - idx;
         if (items) {
+            List_chunk *rest;
+
             /* allocate a small chunk, holding the rest of chunk beyond idx */
             chunk->flags = no_power_2;
             rest = allocate_chunk(interp, list, items,

Reply via email to