Author: petdance
Date: Tue Jun  5 19:00:50 2007
New Revision: 18831

Modified:
   trunk/config/gen/makefiles/root.in
   trunk/include/parrot/hash.h
   trunk/src/hash.c

Log:
hash.c is now headerized

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in  (original)
+++ trunk/config/gen/makefiles/root.in  Tue Jun  5 19:00:50 2007
@@ -1838,6 +1838,7 @@
                src/mmd.o \
                src/objects.o \
                src/key.o \
+               src/hash.o \
 
 
 ###############################################################################

Modified: trunk/include/parrot/hash.h
==============================================================================
--- trunk/include/parrot/hash.h (original)
+++ trunk/include/parrot/hash.h Tue Jun  5 19:00:50 2007
@@ -71,30 +71,69 @@
     hash_hash_key_fn hash_val;  /* generate a hash value for key */
 } Hash;
 
-PARROT_API void parrot_new_hash(Interp *interp, Hash **hptr);
-PARROT_API void parrot_new_pmc_hash(Interp *interp, PMC *container);
-void parrot_new_hash_x(Interp *, Hash**, PARROT_DATA_TYPES,
-        Hash_key_type, hash_comp_fn, hash_hash_key_fn);
-void parrot_new_pmc_hash_x(Interp *, PMC*, PARROT_DATA_TYPES,
-        Hash_key_type, hash_comp_fn, hash_hash_key_fn);
-PARROT_API void parrot_new_cstring_hash(Interp *interp, Hash **);
-PARROT_API void parrot_new_pointer_hash(Interp *interp, Hash **);
-
-PARROT_API PMC* Parrot_new_INTVAL_hash(Interp *interp, UINTVAL flags);
-
-PARROT_API void parrot_hash_clone(Interp *interp, Hash * src, Hash **dest);
-PARROT_API INTVAL parrot_hash_size(Interp *interp, Hash *hash);
-PARROT_API void parrot_hash_set_size(Interp *interp, Hash *hash, UINTVAL size);
-PARROT_API void parrot_hash_destroy(Interp *interp, Hash *hash);
-PARROT_API HashBucket *parrot_hash_get_bucket(Interp *interp, const Hash 
*hash, void *key);
-PARROT_API void *parrot_hash_get(Interp *interp, Hash *hash, void *key);
-PARROT_API INTVAL parrot_hash_exists(Interp *interp, Hash *hash, void *key);
-PARROT_API HashBucket *parrot_hash_put(Interp *interp, Hash *hash, void *key, 
void *value);
-PARROT_API void parrot_hash_delete(Interp *interp, Hash *hash, void *key);
-PARROT_API void parrot_mark_hash(Interp *interp, Hash *hash);
-PARROT_API void parrot_hash_visit(Interp *interp, Hash *hash, void*);
-PARROT_API void parrot_dump_hash(Interp *interp, Hash *hash);
-PARROT_API void* parrot_hash_get_idx(Interp *interp, const Hash *hash, PMC 
*key);
+/* HEADERIZER BEGIN: src/hash.c */
+
+PARROT_API PMC* Parrot_new_INTVAL_hash( Interp *interp, UINTVAL flags );
+PARROT_API void parrot_dump_hash( Interp *interp, const Hash *hash );
+PARROT_API void parrot_hash_clone( Interp *interp,
+    Hash *hash /*NN*/,
+    Hash **dest )
+        __attribute__nonnull__(2);
+
+PARROT_API void parrot_hash_delete( Interp *interp, Hash *hash, void *key );
+PARROT_API void parrot_hash_destroy( Interp *interp, Hash *hash /*NN*/ )
+        __attribute__nonnull__(2);
+
+PARROT_API INTVAL parrot_hash_exists( Interp *interp, Hash *hash, void *key );
+PARROT_API void * parrot_hash_get( Interp *interp, Hash *hash, void *key );
+PARROT_API HashBucket * parrot_hash_get_bucket( Interp *interp,
+    const Hash *hash,
+    void *key );
+
+PARROT_API void * parrot_hash_get_idx( Interp *interp,
+    const Hash *hash,
+    PMC *key /*NN*/ )
+        __attribute__nonnull__(3);
+
+PARROT_API HashBucket* parrot_hash_put( Interp *interp,
+    Hash *hash,
+    void *key,
+    void *value );
+
+PARROT_API INTVAL parrot_hash_size( Interp *interp, Hash *hash /*NN*/ )
+        __attribute__nonnull__(2);
+
+PARROT_API void parrot_hash_visit( Interp *interp,
+    Hash *hash,
+    void *pinfo /*NN*/ )
+        __attribute__nonnull__(3);
+
+PARROT_API void parrot_mark_hash( Interp *interp, Hash *hash /*NN*/ )
+        __attribute__nonnull__(2);
+
+PARROT_API void parrot_new_cstring_hash( Interp *interp, Hash **hptr );
+PARROT_API void parrot_new_hash( Interp *interp, Hash **hptr );
+void parrot_new_hash_x( Interp *interp,
+    Hash **hptr /*NN*/,
+    PARROT_DATA_TYPES val_type,
+    Hash_key_type hkey_type,
+    hash_comp_fn compare,
+    hash_hash_key_fn keyhash )
+        __attribute__nonnull__(2);
+
+PARROT_API void parrot_new_pmc_hash( Interp *interp, PMC *container );
+void parrot_new_pmc_hash_x( Interp *interp,
+    PMC *container /*NN*/,
+    PARROT_DATA_TYPES val_type,
+    Hash_key_type hkey_type,
+    hash_comp_fn compare,
+    hash_hash_key_fn keyhash )
+        __attribute__nonnull__(2);
+
+PARROT_API void parrot_new_pointer_hash( Interp *interp, Hash **hptr /*NN*/ )
+        __attribute__nonnull__(2);
+
+/* HEADERIZER END: src/hash.c */
 
 #endif /* PARROT_HASH_H_GUARD */
 

Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c    (original)
+++ trunk/src/hash.c    Tue Jun  5 19:00:50 2007
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2005, The Perl Foundation.
+Copyright (C) 2001-2007, The Perl Foundation.
 $Id$
 
 =head1 NAME
@@ -21,10 +21,6 @@
 
 =head2 Functions
 
-=over 4
-
-=cut
-
 */
 
 #include "parrot/parrot.h"
@@ -36,19 +32,18 @@
 #define HASH_ALLOC_SIZE(n) (N_BUCKETS(n) * sizeof (HashBucket) + \
                              (n) * sizeof (HashBucket *))
 
+/* HEADER: include/parrot/hash.h */
 
-/*
 
-=item C<static size_t
-key_hash_STRING(Interp *interp, void *value, size_t seed)>
+/*
 
+FUNCDOC:
 Return the hashed value of the key C<value>.
 
-=cut
+see also string.c
 
 */
 
-/* see also string.c */
 
 static size_t
 key_hash_STRING(Interp *interp, STRING *value, size_t seed)
@@ -64,13 +59,9 @@
 
 /*
 
-=item C<static int
-STRING_compare(Parrot_Interp interp, void *hash_key, void *bucket_key)>
-
+FUNCDOC:
 Compares the two strings, returning 0 if they are identical.
 
-=cut
-
 */
 
 static int
@@ -81,13 +72,9 @@
 
 /*
 
-=item C<static int
-pointer_compare(Parrot_Interp interp, void *a, void *b)>
-
+FUNCDOC:
 Compares the two pointers, returning 0 if they are identical
 
-=cut
-
 */
 
 static int
@@ -97,13 +84,9 @@
 
 /*
 
-=item C<static size_t
-key_hash_pointer(Interp *interp, void *value, size_t seed)>
-
+FUNCDOC:
 Returns a hashvalue for a pointer.
 
-=cut
-
 */
 
 static size_t
@@ -111,17 +94,8 @@
     return ((size_t) value) ^ seed;
 }
 
-/*
-
-=item C<static size_t
-key_hash_cstring(Interp *interp, void *value, size_t seed)>
-
-=cut
-
-*/
-
 static size_t
-key_hash_cstring(Interp *interp, void *value, size_t seed)
+key_hash_cstring(Interp *interp, const void *value /*NN*/, size_t seed)
 {
     register size_t h = seed;
     unsigned char * p = (unsigned char *) value;
@@ -134,17 +108,13 @@
 
 /*
 
-=item C<static int
-cstring_compare(Parrot_Interp interp, void *a, void *b)>
-
+FUNCDOC:
 C string versions of the C<key_hash> and C<compare> functions.
 
-=cut
-
 */
 
 static int
-cstring_compare(Parrot_Interp interp, const char *a, const char *b)
+cstring_compare(Parrot_Interp interp, const char *a /*NN*/, const char *b 
/*NN*/)
 {
     UNUSED(interp);
     return strcmp(a, b);
@@ -152,15 +122,8 @@
 
 /*
 
-=item C<static size_t
-key_hash_int(Interp *interp, void *value, size_t seed)>
-
-=item C<static int
-int_compare(Parrot_Interp interp, void *a, void *b)>
-
-Custom C<key_hash> and C<compare> functions.
-
-=cut
+FUNCDOC:
+Custom C<key_hash> function.
 
 */
 
@@ -171,6 +134,20 @@
     return (size_t)value ^ seed;
 }
 
+/*
+
+FUNCDOC:
+Custom C<compare> function.
+
+*/
+
+/*
+
+FUNCDOC:
+Custom C<compare> function.
+
+*/
+
 static int
 int_compare(Parrot_Interp interp, const void *a, const void *b)
 {
@@ -180,37 +157,33 @@
 
 /*
 
-=item C<void
-parrot_dump_hash(Interp *interp, Hash *hash)>
-
-Print out the hash in human-readable form.
+FUNCDOC:
+Print out the hash in human-readable form.  Except it's empty.
 
 =cut
 
 */
 
+PARROT_API
 void
-parrot_dump_hash(Interp *interp, Hash *hash)
+parrot_dump_hash(Interp *interp, const Hash * const hash)
 {
 }
 
 /*
 
-=item C<void
-parrot_mark_hash(Interp *interp, Hash *hash)>
-
+FUNCDOC:
 Marks the hash and its contents as live.
 
-=cut
-
 */
 
+PARROT_API
 void
-parrot_mark_hash(Interp *interp, Hash *hash)
+parrot_mark_hash(Interp *interp, Hash * const hash /*NN*/)
 {
     UINTVAL found = 0;
-    HashBucket *bucket;
-    int mark_key = 0, mark_value = 0;
+    int mark_key = 0;
+    int mark_value = 0;
     size_t i;
 
     if (hash->entry_type == enum_hash_string ||
@@ -223,7 +196,8 @@
         return;
 
     for (i = 0; i <= hash->mask; i++) {
-        bucket = hash->bi[i];
+        HashBucket *bucket = hash->bi[i];
+
         while (bucket) {
             if (++found > hash->entries)
                 internal_exception(1,
@@ -240,40 +214,39 @@
 
 /*
 
-=item C<void
-parrot_hash_visit(Interp *interp, Hash *hash, void* pinfo)>
-
+FUNCDOC:
 This is used by freeze/thaw to visit the contents of the hash.
 
 C<pinfo> is the visit info, (see include/parrot/pmc_freeze.h>).
 
-=cut
-
 */
 
 static void
-hash_thaw(Interp *interp, Hash *hash, visit_info* info)
+hash_thaw(Interp *interp, Hash *hash /*NN*/, visit_info* info)
 {
-    size_t i, n;
-    STRING *s_key;
-    INTVAL i_key;
-    IMAGE_IO *io = info->image_io;
+    size_t i;
+    IMAGE_IO * const io = info->image_io;
     HashBucket *b;
 
     /*
      * during thaw info->extra is the key/value count
      */
-    n = (size_t) hash->entries;
+    const size_t n = (size_t) hash->entries;
+
     hash->entries = 0;
     for (i = 0; i < n; ++i) {
         switch (hash->key_type) {
             case Hash_key_type_STRING:
-                s_key = io->vtable->shift_string(interp, io);
+                {
+                STRING * const s_key = io->vtable->shift_string(interp, io);
                 b = parrot_hash_put(interp, hash, s_key, NULL);
+                }
                 break;
             case Hash_key_type_int:
-                i_key = io->vtable->shift_integer(interp, io);
+                {
+                const INTVAL i_key = io->vtable->shift_integer(interp, io);
                 b = parrot_hash_put(interp, hash, (void*)i_key, NULL);
+                }
                 break;
             default:
                 internal_exception(1, "unimplemented key type");
@@ -296,14 +269,14 @@
 }
 
 static void
-hash_freeze(Interp *interp, Hash *hash, visit_info* info)
+hash_freeze(Interp *interp, const Hash * const hash, visit_info* info /*NN*/)
 {
     size_t i;
-    IMAGE_IO *io = info->image_io;
-    HashBucket *b;
+    IMAGE_IO * const io = info->image_io;
 
     for (i = 0; i <= hash->mask; i++) {
-        b = hash->bi[i];
+        HashBucket *b = hash->bi[i];
+
         while (b) {
             switch (hash->key_type) {
                 case Hash_key_type_STRING:
@@ -333,10 +306,11 @@
     }
 }
 
+PARROT_API
 void
-parrot_hash_visit(Interp *interp, Hash *hash, void* pinfo)
+parrot_hash_visit(Interp *interp, Hash *hash, void *pinfo /*NN*/)
 {
-    visit_info* info = (visit_info*) pinfo;
+    visit_info* const info = (visit_info*) pinfo;
 
     switch (info->what) {
         case VISIT_THAW_NORMAL:
@@ -355,9 +329,7 @@
 
 /*
 
-=item C<static void
-expand_hash(Interp *interp, Hash *hash)>
-
+FUNCDOC:
 For a hashtable of size N, we use C<MAXFULL_PERCENT> % of N as the
 number of buckets. This way, as soon as we run out of buckets on the
 free list, we know that it's time to resize the hashtable.
@@ -380,20 +352,15 @@
 sequential scans. (Of course, this also mucks with the C<< ->next >>
 pointers, and they'll be all over memory.)
 
-=cut
-
 */
 
 static void
-expand_hash(Interp *interp, Hash *hash)
+expand_hash(Interp *interp, Hash *hash /*NN*/)
 {
-    UINTVAL old_size = hash->mask + 1;
-    UINTVAL new_size = old_size << 1;
-    UINTVAL old_nb;
+    const UINTVAL old_size = hash->mask + 1;
+    const UINTVAL new_size = old_size << 1;
     HashBucket **old_bi, **new_bi;
-    HashBucket  *bs, *b, **next_p;
-    void *old_mem;
-    HashBucket *new_mem;
+    HashBucket  *bs, *b;
     size_t offset, i, new_loc;
 
     /*
@@ -406,12 +373,13 @@
          ^           ^
          | old_mem   | hash->bi
     */
-    old_nb = N_BUCKETS(old_size);
-    old_mem = hash->bs;
+    const UINTVAL old_nb = N_BUCKETS(old_size);
+    void * const old_mem = hash->bs;
     /*
      * resize mem
      */
-    new_mem = (HashBucket *)mem_sys_realloc(old_mem, 
HASH_ALLOC_SIZE(new_size));
+    HashBucket * const new_mem =
+        (HashBucket *)mem_sys_realloc(old_mem, HASH_ALLOC_SIZE(new_size));
     /*
          +---+---+---+---+---+---+-+-+-+-+-+-+-+-+
          |  bs       | old_bi    |  new_bi       |
@@ -442,7 +410,7 @@
      */
     if (offset) {
         for (i = 0; i < old_size; ++i) {
-            next_p = new_bi + i;
+            HashBucket **next_p = new_bi + i;
             while (*next_p) {
                 *next_p = (HashBucket *)((char *)*next_p + offset);
                 b = *next_p;
@@ -452,7 +420,7 @@
     }
     /* recalc bucket index */
     for (i = 0; i < old_size; ++i) {
-        next_p = new_bi + i;
+        HashBucket **next_p = new_bi + i;
         while (*next_p) {
             b = *next_p;
             /* rehash the bucket */
@@ -481,19 +449,12 @@
 
 /*
 
-=item C<void
-parrot_new_hash(Interp *interp, Hash **hptr)>
-
+FUNCDOC:
 Returns a new Parrot STRING hash in C<hptr>.
 
-parrot_new_pmc_hash(Interp *interp, PMC *container)>
-
-Create a new Parrot STRING hash in PMC_struct_val(container)
-
-=cut
-
 */
 
+PARROT_API
 void
 parrot_new_hash(Interp *interp, Hash **hptr)
 {
@@ -504,6 +465,14 @@
             (hash_hash_key_fn)key_hash_STRING);    /*        hash */
 }
 
+/*
+
+FUNCDOC:
+Create a new Parrot STRING hash in PMC_struct_val(container)
+
+*/
+
+PARROT_API
 void
 parrot_new_pmc_hash(Interp *interp, PMC *container)
 {
@@ -515,15 +484,12 @@
 }
 /*
 
-=item C<void
-parrot_new_cstring_hash(Interp *interp, Hash **hptr)>
-
+FUNCDOC:
 Returns a new C string hash in C<hptr>.
 
-=cut
-
 */
 
+PARROT_API
 void
 parrot_new_cstring_hash(Interp *interp, Hash **hptr)
 {
@@ -534,39 +500,6 @@
             (hash_hash_key_fn)key_hash_cstring);    /*        hash */
 }
 
-/*
-
-=item C<void
-parrot_new_hash_x(Interp *interp, Hash **hptr,
-        PARROT_DATA_TYPES val_type,
-        Hash_key_type hkey_type,
-        hash_comp_fn compare, hash_hash_key_fn keyhash)>
-
-Returns a new hash in C<hptr>.
-
-FIXME: This function can go back to just returning the hash struct
-pointer once Buffers can define their own custom mark routines.
-
-The problem is: During DODs stack walking the item on the stack must be
-a PMC. When an auto C<Hash*> is seen, it doesn't get properly marked
-(only the C<Hash*> buffer is marked, not its contents). By passing the
-C<**hptr> up to the Hash's init function, the newly constructed PMC is
-on the stack I<including> this newly constructed Hash, so that it gets
-marked properly.
-
-=item C<void
-parrot_new_pmc_hash_x(Interp *interp, PMC *container,
-        PARROT_DATA_TYPES val_type,
-        Hash_key_type hkey_type,
-        hash_comp_fn compare, hash_hash_key_fn keyhash)>
-
-Like above but w/o the described problems. The passed in C<container> PMC gets
-stored in the Hash end the newly created Hash is in PMC_struct_val(container).
-
-=cut
-
-*/
-
 static void
 init_hash(Interp *interp, Hash *hash,
         PARROT_DATA_TYPES val_type,
@@ -613,33 +546,60 @@
     }
 }
 
+PARROT_API
 void
-parrot_hash_destroy(Interp *interp, Hash *hash)
+parrot_hash_destroy(Interp *interp, Hash *hash /*NN*/)
 {
     mem_sys_free(hash->bs);
     mem_sys_free(hash);
 }
 
+/*
+
+FUNCDOC: parrot_new_hash_x
+Returns a new hash in C<hptr>.
+
+FIXME: This function can go back to just returning the hash struct
+pointer once Buffers can define their own custom mark routines.
+
+The problem is: During DODs stack walking the item on the stack must be
+a PMC. When an auto C<Hash*> is seen, it doesn't get properly marked
+(only the C<Hash*> buffer is marked, not its contents). By passing the
+C<**hptr> up to the Hash's init function, the newly constructed PMC is
+on the stack I<including> this newly constructed Hash, so that it gets
+marked properly.
+
+*/
+
 void
-parrot_new_hash_x(Interp *interp, Hash **hptr,
+parrot_new_hash_x(Interp *interp, Hash **hptr /*NN*/,
         PARROT_DATA_TYPES val_type,
         Hash_key_type hkey_type,
         hash_comp_fn compare, hash_hash_key_fn keyhash)
 {
-    Hash *hash = mem_allocate_typed(Hash);
+    Hash * const hash = mem_allocate_typed(Hash);
     hash->container = NULL;
     *hptr = hash;
     init_hash(interp, hash, val_type, hkey_type,
             compare, keyhash);
 }
 
+/*
+
+FUNCDOC: parrot_new_pmc_hash_x
+Like parrot_new_hash_x but w/o the described problems. The passed in
+C<container> PMC gets stored in the Hash end the newly created Hash is
+in PMC_struct_val(container).
+
+*/
+
 void
-parrot_new_pmc_hash_x(Interp *interp, PMC *container,
+parrot_new_pmc_hash_x(Interp *interp, PMC *container /*NN*/,
         PARROT_DATA_TYPES val_type,
         Hash_key_type hkey_type,
         hash_comp_fn compare, hash_hash_key_fn keyhash)
 {
-    Hash *hash = mem_allocate_typed(Hash);
+    Hash * const hash = mem_allocate_typed(Hash);
     PMC_struct_val(container) = hash;
     hash->container = container;
     init_hash(interp, hash, val_type, hkey_type,
@@ -648,32 +608,28 @@
 
 /*
 
-=item C<void
-parrot_new_pointer_hash(Interp *interp, Hash **hptr)>
-
+FUNCDOC:
 Create a new HASH with void * keys and values.
 
-=cut
 */
 
+PARROT_API
 void
-parrot_new_pointer_hash(Interp *interp, Hash **hptr)
+parrot_new_pointer_hash(Interp *interp, Hash **hptr /*NN*/)
 {
-   parrot_new_hash_x(interp, hptr, enum_type_ptr, Hash_key_type_ptr,
+    parrot_new_hash_x(interp, hptr, enum_type_ptr, Hash_key_type_ptr,
                         pointer_compare, key_hash_pointer);
 }
 
 /*
 
-=item C<PMC* Parrot_new_INTVAL_hash(Interp *interp, UINTVAL flags)>
-
+FUNCDOC:
 Create a new Hash PMC with INTVAL keys and values. C<flags> can be
 C<PObj_constant_FLAG> or 0.
 
-=cut
-
 */
 
+PARROT_API
 PMC*
 Parrot_new_INTVAL_hash(Interp *interp, UINTVAL flags)
 {
@@ -691,17 +647,14 @@
 
 /*
 
-=item C<INTVAL
-parrot_hash_size(Interp *interp, Hash *hash)>
-
+FUNCDOC:
 Return the number of used entries in the hash.
 
-=cut
-
 */
 
+PARROT_API
 INTVAL
-parrot_hash_size(Interp *interp, Hash *hash)
+parrot_hash_size(Interp *interp, Hash *hash /*NN*/)
 {
     UNUSED(interp);
 
@@ -713,29 +666,25 @@
 
 /*
 
-=item C<void *
-parrot_hash_get_idx(Interp *interp, const Hash *hash, PMC * key)>
-
+FUNCDOC:
 Called by iterator.
 
-=cut
-
 */
 
+PARROT_API
 void *
-parrot_hash_get_idx(Interp *interp, const Hash *hash, PMC * key)
+parrot_hash_get_idx(Interp *interp, const Hash *hash, PMC * const key /*NN*/)
 {
     INTVAL i = PMC_int_val(key);
     const BucketIndex bi = (BucketIndex)PMC_data(key);
     HashBucket *b;
     void *res;
-    INTVAL size;
 
     /* idx directly in the bucket store, which is at negative
      * address from the data pointer
      */
     /* locate initial */
-    size = (INTVAL)N_BUCKETS(hash->mask + 1);
+    const INTVAL size = (INTVAL)N_BUCKETS(hash->mask + 1);
     if (bi == INITBucketIndex) {
         i = 0;
         PMC_data(key) = NULL;
@@ -765,15 +714,12 @@
 
 /*
 
-=item C<HashBucket *
-parrot_hash_get_bucket(Interp *interp, const Hash *hash, void *key)>
-
+FUNCDOC:
 Returns the bucket for C<key>.
 
-=cut
-
 */
 
+PARROT_API
 HashBucket *
 parrot_hash_get_bucket(Interp *interp, const Hash *hash, void *key)
 {
@@ -790,15 +736,12 @@
 
 /*
 
-=item C<void *
-parrot_hash_get(Interp *interp, Hash *hash, void *key)>
-
+FUNCDOC:
 Returns the bucket for C<key> or C<NULL> if no bucket is found.
 
-=cut
-
 */
 
+PARROT_API
 void *
 parrot_hash_get(Interp *interp, Hash *hash, void *key)
 {
@@ -808,15 +751,12 @@
 
 /*
 
-=item C<INTVAL
-parrot_hash_exists(Interp *interp, Hash *hash, void *key)>
-
+FUNCDOC:
 Returns whether the key exists in the hash.
 
-=cut
-
 */
 
+PARROT_API
 INTVAL
 parrot_hash_exists(Interp *interp, Hash *hash, void *key)
 {
@@ -826,16 +766,13 @@
 
 /*
 
-=item C<HashBucket*
-parrot_hash_put(Interp *interp, Hash *hash, void *key, void *value)>
-
+FUNCDOC:
 Puts the key and value into the hash. Note that C<key> is B<not>
 copied.
 
-=cut
-
 */
 
+PARROT_API
 HashBucket*
 parrot_hash_put(Interp *interp, Hash *hash, void *key, void *value)
 {
@@ -877,15 +814,12 @@
 
 /*
 
-=item C<void
-parrot_hash_delete(Interp *interp, Hash *hash, void *key)>
-
+FUNCDOC:
 Deletes the key from the hash.
 
-=cut
-
 */
 
+PARROT_API
 void
 parrot_hash_delete(Interp *interp, Hash *hash, void *key)
 {
@@ -913,25 +847,21 @@
 
 /*
 
-=item C<void
-parrot_hash_clone(Interp *interp, Hash *hash, Hash **dest)>
-
+FUNCDOC:
 Clones C<hash> to C<dest>.
 
-=cut
-
 */
 
+PARROT_API
 void
-parrot_hash_clone(Interp *interp, Hash *hash, Hash **dest)
+parrot_hash_clone(Interp *interp, Hash *hash /*NN*/, Hash **dest)
 {
     UINTVAL i;
-    HashBucket *b;
 
     parrot_new_hash_x(interp, dest, hash->entry_type,
             hash->key_type, hash->compare, hash->hash_val);
     for (i = 0; i <= hash->mask; i++) {
-        b = hash->bi[i];
+        HashBucket *b = hash->bi[i];
         while (b) {
             void * const key = b->key;
             void *valtmp;
@@ -963,8 +893,6 @@
 
 /*
 
-=back
-
 =head1 SEE ALSO
 
 F<docs/pdds/pdd08_keys.pod>.

Reply via email to