Ticket #1741: 0006-another-manual-iteration-over-hashes-replaced-with-m.patch

File 0006-another-manual-iteration-over-hashes-replaced-with-m.patch, 1.0 KB (added by luben, 4 years ago)
  • src/hash.c

    From 8be1058a8b00d1ada767e646be43329d2801a2e0 Mon Sep 17 00:00:00 2001
    From: luben <karavelov@spnet.net>
    Date: Sun, 15 Aug 2010 03:51:29 +0300
    Subject: [PATCH 6/7] another manual iteration over hashes replaced with macro
    
    ---
     src/hash.c |   14 +++-----------
     1 files changed, 3 insertions(+), 11 deletions(-)
    
    diff --git a/src/hash.c b/src/hash.c
    index 8f5bcf2..74ee64e 100644
    a b  
    11151115parrot_chash_destroy_values(PARROT_INTERP, ARGMOD(Hash *hash), NOTNULL(value_free func)) 
    11161116{ 
    11171117    ASSERT_ARGS(parrot_chash_destroy_values) 
    1118     UINTVAL i; 
    1119  
    1120     for (i = 0; i <= hash->mask; ++i) { 
    1121         HashBucket *bucket = hash->index[i]; 
    1122         while (bucket) { 
    1123             mem_gc_free(interp, bucket->key); 
    1124             func(bucket->value); 
    1125             bucket = bucket->next; 
    1126         } 
    1127     } 
    1128  
     1118    parrot_hash_iterate(hash, 
     1119        mem_gc_free(interp, _bucket->value); 
     1120    ); 
    11291121    parrot_hash_destroy(interp, hash); 
    11301122} 
    11311123