~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-updates

« back to all changes in this revision

Viewing changes to st.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-04 16:01:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070904160117-i15zckg2nhxe9fyw
Tags: 1.9.0+20070830-2ubuntu1
* Sync from Debian; remaining changes:
  - Add -g to CFLAGS.
* Fixes build failure on ia64.
* Fixes build failure with gcc-4.2 on lpia.
* Robustify check for target_os, fixing build failure on lpia.
* Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
/* static       char    sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible"; */
4
4
 
5
 
#include "config.h"
6
5
#include <stdio.h>
7
6
#ifdef HAVE_STDLIB_H
8
7
#include <stdlib.h>
9
8
#endif
10
9
#include <string.h>
11
 
#include "defines.h"
12
10
 
13
11
#ifdef NOT_RUBY
14
12
#include "regint.h"
15
 
#endif
16
 
 
17
13
#include "st.h"
 
14
#else
 
15
#include "ruby/config.h"
 
16
#include "ruby/defines.h"
 
17
#include "ruby/st.h"
 
18
#endif
18
19
 
19
20
typedef struct st_table_entry st_table_entry;
20
21
 
23
24
    st_data_t key;
24
25
    st_data_t record;
25
26
    st_table_entry *next;
 
27
    st_table_entry *fore, *back;
26
28
};
27
29
 
28
30
#define ST_DEFAULT_MAX_DENSITY 5
38
40
     *
39
41
     */
40
42
 
41
 
static struct st_hash_type type_numhash = {
 
43
static const struct st_hash_type type_numhash = {
42
44
    st_numcmp,
43
45
    st_numhash,
44
46
};
45
47
 
46
48
/* extern int strcmp(const char *, const char *); */
47
49
static int strhash(const char *);
48
 
static struct st_hash_type type_strhash = {
 
50
static const struct st_hash_type type_strhash = {
49
51
    strcmp,
50
52
    strhash,
51
53
};
143
145
}
144
146
#endif
145
147
 
 
148
#define MAX_PACKED_NUMHASH 5
 
149
 
146
150
st_table*
147
 
st_init_table_with_size(struct st_hash_type *type, int size)
 
151
st_init_table_with_size(const struct st_hash_type *type, int size)
148
152
{
149
153
    st_table *tbl;
150
154
 
160
164
    tbl = alloc(st_table);
161
165
    tbl->type = type;
162
166
    tbl->num_entries = 0;
 
167
    tbl->entries_packed = type == &type_numhash && size/2 <= MAX_PACKED_NUMHASH;
163
168
    tbl->num_bins = size;
164
169
    tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*));
 
170
    tbl->head = 0;
165
171
 
166
172
    return tbl;
167
173
}
168
174
 
169
175
st_table*
170
 
st_init_table(struct st_hash_type *type)
 
176
st_init_table(const struct st_hash_type *type)
171
177
{
172
178
    return st_init_table_with_size(type, 0);
173
179
}
197
203
}
198
204
 
199
205
void
 
206
st_clear(st_table *table)
 
207
{
 
208
    register st_table_entry *ptr, *next;
 
209
    int i;
 
210
 
 
211
    if (table->entries_packed) {
 
212
        table->num_entries = 0;
 
213
        return;
 
214
    }
 
215
 
 
216
    for(i = 0; i < table->num_bins; i++) {
 
217
        ptr = table->bins[i];
 
218
        table->bins[i] = 0;
 
219
        while (ptr != 0) {
 
220
            next = ptr->next;
 
221
            free(ptr);
 
222
            ptr = next;
 
223
        }
 
224
    }
 
225
    table->num_entries = 0;
 
226
    table->head = 0;
 
227
}
 
228
 
 
229
void
200
230
st_free_table(st_table *table)
201
231
{
202
 
    register st_table_entry *ptr, *next;
203
 
    int i;
204
 
 
205
 
    for(i = 0; i < table->num_bins; i++) {
206
 
        ptr = table->bins[i];
207
 
        while (ptr != 0) {
208
 
            next = ptr->next;
209
 
            free(ptr);
210
 
            ptr = next;
211
 
        }
212
 
    }
 
232
    st_clear(table);
213
233
    free(table->bins);
214
234
    free(table);
215
235
}
241
261
    unsigned int hash_val, bin_pos;
242
262
    register st_table_entry *ptr;
243
263
 
 
264
    if (table->entries_packed) {
 
265
        int i;
 
266
        for (i = 0; i < table->num_entries; i++) {
 
267
            if ((st_data_t)table->bins[i*2] == key) {
 
268
                if (value !=0) *value = (st_data_t)table->bins[i*2+1];
 
269
                return 1;
 
270
            }
 
271
        }
 
272
        return 0;
 
273
    }
 
274
 
244
275
    hash_val = do_hash(key, table);
245
276
    FIND_ENTRY(table, ptr, hash_val, bin_pos);
246
277
 
255
286
 
256
287
#define ADD_DIRECT(table, key, value, hash_val, bin_pos)\
257
288
do {\
258
 
    st_table_entry *entry;\
 
289
    st_table_entry *entry, *head;\
259
290
    if (table->num_entries/(table->num_bins) > ST_DEFAULT_MAX_DENSITY) {\
260
291
        rehash(table);\
261
292
        bin_pos = hash_val % table->num_bins;\
267
298
    entry->key = key;\
268
299
    entry->record = value;\
269
300
    entry->next = table->bins[bin_pos];\
 
301
    if ((head = table->head) != 0) {\
 
302
        entry->fore = head;\
 
303
        (entry->back = head->back)->fore = entry;\
 
304
        head->back = entry;\
 
305
    }\
 
306
    else {\
 
307
        table->head = entry->fore = entry->back = entry;\
 
308
    }\
270
309
    table->bins[bin_pos] = entry;\
271
310
    table->num_entries++;\
272
311
} while (0)
273
312
 
 
313
static void
 
314
unpack_entries(register st_table *table)
 
315
{
 
316
    int i;
 
317
    struct st_table_entry *packed_bins[MAX_PACKED_NUMHASH*2];
 
318
    int num_entries = table->num_entries;
 
319
 
 
320
    memcpy(packed_bins, table->bins, sizeof(struct st_table_entry *) * num_entries*2);
 
321
    table->entries_packed = 0;
 
322
    table->num_entries = 0;
 
323
    memset(table->bins, 0, sizeof(struct st_table_entry *) * table->num_bins);
 
324
    for (i = 0; i < num_entries; i++) {
 
325
        st_insert(table, (st_data_t)packed_bins[i*2], (st_data_t)packed_bins[i*2+1]);
 
326
    }
 
327
}
 
328
 
274
329
int
275
330
st_insert(register st_table *table, register st_data_t key, st_data_t value)
276
331
{
277
332
    unsigned int hash_val, bin_pos;
278
333
    register st_table_entry *ptr;
279
334
 
 
335
    if (table->entries_packed) {
 
336
        int i;
 
337
        for (i = 0; i < table->num_entries; i++) {
 
338
            if ((st_data_t)table->bins[i*2] == key) {
 
339
                table->bins[i*2+1] = (struct st_table_entry*)value;
 
340
                return 1;
 
341
            }
 
342
        }
 
343
        if ((table->num_entries+1) * 2 <= table->num_bins && table->num_entries+1 <= MAX_PACKED_NUMHASH) {
 
344
            i = table->num_entries++;
 
345
            table->bins[i*2] = (struct st_table_entry*)key;
 
346
            table->bins[i*2+1] = (struct st_table_entry*)value;
 
347
            return 0;
 
348
        }
 
349
        else {
 
350
            unpack_entries(table);
 
351
        }
 
352
    }
 
353
 
280
354
    hash_val = do_hash(key, table);
281
355
    FIND_ENTRY(table, ptr, hash_val, bin_pos);
282
356
 
295
369
{
296
370
    unsigned int hash_val, bin_pos;
297
371
 
 
372
    if (table->entries_packed) {
 
373
        int i;
 
374
        if ((table->num_entries+1) * 2 <= table->num_bins && table->num_entries+1 <= MAX_PACKED_NUMHASH) {
 
375
            i = table->num_entries++;
 
376
            table->bins[i*2] = (struct st_table_entry*)key;
 
377
            table->bins[i*2+1] = (struct st_table_entry*)value;
 
378
            return;
 
379
        }
 
380
        else {
 
381
            unpack_entries(table);
 
382
        }
 
383
    }
 
384
 
298
385
    hash_val = do_hash(key, table);
299
386
    bin_pos = hash_val % table->num_bins;
300
387
    ADD_DIRECT(table, key, value, hash_val, bin_pos);
303
390
static void
304
391
rehash(register st_table *table)
305
392
{
306
 
    register st_table_entry *ptr, *next, **new_bins;
307
 
    int i, old_num_bins = table->num_bins, new_num_bins;
 
393
    register st_table_entry *ptr, **new_bins;
 
394
    int i, new_num_bins;
308
395
    unsigned int hash_val;
309
396
 
310
 
    new_num_bins = new_size(old_num_bins+1);
311
 
    new_bins = (st_table_entry**)Calloc(new_num_bins, sizeof(st_table_entry*));
 
397
    new_num_bins = new_size(table->num_bins+1);
 
398
    new_bins = (st_table_entry**)
 
399
        xrealloc(table->bins, new_num_bins * sizeof(st_table_entry*));
 
400
    for (i = 0; i < new_num_bins; ++i) new_bins[i] = 0;
 
401
    table->num_bins = new_num_bins;
 
402
    table->bins = new_bins;
312
403
 
313
 
    for(i = 0; i < old_num_bins; i++) {
314
 
        ptr = table->bins[i];
315
 
        while (ptr != 0) {
316
 
            next = ptr->next;
 
404
    if ((ptr = table->head) != 0) {
 
405
        do {
317
406
            hash_val = ptr->hash % new_num_bins;
318
407
            ptr->next = new_bins[hash_val];
319
408
            new_bins[hash_val] = ptr;
320
 
            ptr = next;
321
 
        }
 
409
        } while ((ptr = ptr->fore) != table->head);
322
410
    }
323
 
    free(table->bins);
324
 
    table->num_bins = new_num_bins;
325
 
    table->bins = new_bins;
326
411
}
327
412
 
328
413
st_table*
329
414
st_copy(st_table *old_table)
330
415
{
331
416
    st_table *new_table;
332
 
    st_table_entry *ptr, *entry;
333
 
    int i, num_bins = old_table->num_bins;
 
417
    st_table_entry *ptr, *entry, *prev, **tail;
 
418
    int num_bins = old_table->num_bins;
 
419
    unsigned int hash_val;
334
420
 
335
421
    new_table = alloc(st_table);
336
422
    if (new_table == 0) {
346
432
        return 0;
347
433
    }
348
434
 
349
 
    for(i = 0; i < num_bins; i++) {
350
 
        new_table->bins[i] = 0;
351
 
        ptr = old_table->bins[i];
352
 
        while (ptr != 0) {
 
435
    if (old_table->entries_packed) {
 
436
        memcpy(new_table->bins, old_table->bins, sizeof(struct st_table_entry *) * old_table->num_bins);
 
437
        return new_table;
 
438
    }
 
439
 
 
440
    if ((ptr = old_table->head) != 0) {
 
441
        prev = 0;
 
442
        tail = &new_table->head;
 
443
        do {
353
444
            entry = alloc(st_table_entry);
354
445
            if (entry == 0) {
355
 
                free(new_table->bins);
356
 
                free(new_table);
 
446
                st_free_table(new_table);
357
447
                return 0;
358
448
            }
359
449
            *entry = *ptr;
360
 
            entry->next = new_table->bins[i];
361
 
            new_table->bins[i] = entry;
362
 
            ptr = ptr->next;
363
 
        }
 
450
            hash_val = entry->hash % num_bins;
 
451
            entry->next = new_table->bins[hash_val];
 
452
            new_table->bins[hash_val] = entry;
 
453
            entry->back = prev;
 
454
            *tail = prev = entry;
 
455
            tail = &entry->fore;
 
456
        } while ((ptr = ptr->fore) != old_table->head);
 
457
        entry = new_table->head;
 
458
        entry->back = prev;
 
459
        *tail = entry;
364
460
    }
 
461
 
365
462
    return new_table;
366
463
}
367
464
 
 
465
#define REMOVE_ENTRY(table, ptr) do                                     \
 
466
    {                                                                   \
 
467
        if (ptr == ptr->fore) {                                         \
 
468
            table->head = 0;                                            \
 
469
        }                                                               \
 
470
        else {                                                          \
 
471
            st_table_entry *fore = ptr->fore, *back = ptr->back;        \
 
472
            fore->back = back;                                          \
 
473
            back->fore = fore;                                          \
 
474
            if (ptr == table->head) table->head = fore;                 \
 
475
        }                                                               \
 
476
        table->num_entries--;                                           \
 
477
    } while (0)
 
478
 
368
479
int
369
480
st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
370
481
{
371
482
    unsigned int hash_val;
372
 
    st_table_entry *tmp;
 
483
    st_table_entry **prev;
373
484
    register st_table_entry *ptr;
374
485
 
 
486
    if (table->entries_packed) {
 
487
        int i;
 
488
        for (i = 0; i < table->num_entries; i++) {
 
489
            if ((st_data_t)table->bins[i*2] == *key) {
 
490
                if (value != 0) *value = (st_data_t)table->bins[i*2+1];
 
491
                table->num_entries--;
 
492
                memmove(&table->bins[i*2], &table->bins[(i+1)*2],
 
493
                        sizeof(struct st_table_entry*) * 2*(table->num_entries-i));
 
494
                return 1;
 
495
            }
 
496
        }
 
497
        if (value != 0) *value = 0;
 
498
        return 0;
 
499
    }
 
500
 
375
501
    hash_val = do_hash_bin(*key, table);
376
 
    ptr = table->bins[hash_val];
377
 
 
378
 
    if (ptr == 0) {
379
 
        if (value != 0) *value = 0;
380
 
        return 0;
381
 
    }
382
 
 
383
 
    if (EQUAL(table, *key, ptr->key)) {
384
 
        table->bins[hash_val] = ptr->next;
385
 
        table->num_entries--;
386
 
        if (value != 0) *value = ptr->record;
387
 
        *key = ptr->key;
388
 
        free(ptr);
389
 
        return 1;
390
 
    }
391
 
 
392
 
    for(; ptr->next != 0; ptr = ptr->next) {
393
 
        if (EQUAL(table, ptr->next->key, *key)) {
394
 
            tmp = ptr->next;
395
 
            ptr->next = ptr->next->next;
396
 
            table->num_entries--;
397
 
            if (value != 0) *value = tmp->record;
398
 
            *key = tmp->key;
399
 
            free(tmp);
 
502
 
 
503
    for (prev = &table->bins[hash_val]; (ptr = *prev) != 0; prev = &ptr->next) {
 
504
        if (EQUAL(table, *key, ptr->key)) {
 
505
            *prev = ptr->next;
 
506
            REMOVE_ENTRY(table, ptr);
 
507
            if (value != 0) *value = ptr->record;
 
508
            *key = ptr->key;
 
509
            free(ptr);
400
510
            return 1;
401
511
        }
402
512
    }
403
513
 
 
514
    if (value != 0) *value = 0;
404
515
    return 0;
405
516
}
406
517
 
413
524
    hash_val = do_hash_bin(*key, table);
414
525
    ptr = table->bins[hash_val];
415
526
 
416
 
    if (ptr == 0) {
417
 
        if (value != 0) *value = 0;
418
 
        return 0;
419
 
    }
420
 
 
421
 
    for(; ptr != 0; ptr = ptr->next) {
 
527
    for (; ptr != 0; ptr = ptr->next) {
422
528
        if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) {
423
 
            table->num_entries--;
 
529
            REMOVE_ENTRY(table, ptr);
424
530
            *key = ptr->key;
425
531
            if (value != 0) *value = ptr->record;
426
532
            ptr->key = ptr->record = never;
428
534
        }
429
535
    }
430
536
 
 
537
    if (value != 0) *value = 0;
431
538
    return 0;
432
539
}
433
540
 
434
 
static int
435
 
delete_never(st_data_t key, st_data_t value, st_data_t never)
436
 
{
437
 
    if (value == never) return ST_DELETE;
438
 
    return ST_CONTINUE;
439
 
}
440
 
 
441
541
void
442
542
st_cleanup_safe(st_table *table, st_data_t never)
443
543
{
444
 
    int num_entries = table->num_entries;
 
544
    st_table_entry *ptr, **last, *tmp;
 
545
    int i;
445
546
 
446
 
    st_foreach(table, delete_never, never);
447
 
    table->num_entries = num_entries;
 
547
    for (i = 0; i < table->num_bins; i++) {
 
548
        ptr = *(last = &table->bins[i]);
 
549
        while (ptr != 0) {
 
550
            if (ptr->key == never) {
 
551
                tmp = ptr;
 
552
                *last = ptr = ptr->next;
 
553
                free(tmp);
 
554
            }
 
555
            else {
 
556
                ptr = *(last = &ptr->next);
 
557
            }
 
558
        }
 
559
    }
448
560
}
449
561
 
450
562
int
451
563
st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
452
564
{
453
 
    st_table_entry *ptr, *last, *tmp;
 
565
    st_table_entry *ptr, **last, *tmp;
454
566
    enum st_retval retval;
455
 
    int i;
456
 
 
457
 
    for(i = 0; i < table->num_bins; i++) {
458
 
        last = 0;
459
 
        for(ptr = table->bins[i]; ptr != 0;) {
 
567
    int i, end;
 
568
 
 
569
    if (table->entries_packed) {
 
570
        for (i = 0; i < table->num_entries; i++) {
 
571
            int j;
 
572
            st_data_t key, val;
 
573
            key = (st_data_t)table->bins[i*2];
 
574
            val = (st_data_t)table->bins[i*2+1];
 
575
            retval = (*func)(key, val, arg);
 
576
            switch (retval) {
 
577
              case ST_CHECK:    /* check if hash is modified during iteration */
 
578
                for (j = 0; j < table->num_entries; j++) {
 
579
                    if ((st_data_t)table->bins[j*2] == key)
 
580
                        break;
 
581
                }
 
582
                if (j == table->num_entries) {
 
583
                    /* call func with error notice */
 
584
                    retval = (*func)(0, 0, arg, 1);
 
585
                    return 1;
 
586
                }
 
587
                /* fall through */
 
588
              case ST_CONTINUE:
 
589
                break;
 
590
              case ST_STOP:
 
591
                return 0;
 
592
              case ST_DELETE:
 
593
                table->num_entries--;
 
594
                memmove(&table->bins[i*2], &table->bins[(i+1)*2],
 
595
                        sizeof(struct st_table_entry*) * 2*(table->num_entries-i));
 
596
                i--;
 
597
                break;
 
598
            }
 
599
        }
 
600
        return 0;
 
601
    }
 
602
 
 
603
    if ((ptr = table->head) != 0) {
 
604
        do {
 
605
            end = ptr->fore == table->head;
460
606
            retval = (*func)(ptr->key, ptr->record, arg);
461
607
            switch (retval) {
462
 
            case ST_CHECK:      /* check if hash is modified during iteration */
463
 
                tmp = 0;
464
 
                if (i < table->num_bins) {
465
 
                    for (tmp = table->bins[i]; tmp; tmp=tmp->next) {
466
 
                        if (tmp == ptr) break;
467
 
                    }
468
 
                }
469
 
                if (!tmp) {
470
 
                    /* call func with error notice */
471
 
                    return 1;
472
 
                }
473
 
                /* fall through */
474
 
            case ST_CONTINUE:
475
 
                last = ptr;
476
 
                ptr = ptr->next;
477
 
                break;
478
 
            case ST_STOP:
479
 
                return 0;
480
 
            case ST_DELETE:
481
 
                tmp = ptr;
482
 
                if (last == 0) {
483
 
                    table->bins[i] = ptr->next;
484
 
                }
485
 
                else {
486
 
                    last->next = ptr->next;
 
608
              case ST_CHECK:    /* check if hash is modified during iteration */
 
609
                i = ptr->hash % table->num_bins;
 
610
                for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) {
 
611
                    if (!tmp) {
 
612
                        /* call func with error notice */
 
613
                        retval = (*func)(0, 0, arg, 1);
 
614
                        return 1;
 
615
                    }
 
616
                }
 
617
                /* fall through */
 
618
              case ST_CONTINUE:
 
619
                ptr = ptr->fore;
 
620
                break;
 
621
              case ST_STOP:
 
622
                return 0;
 
623
              case ST_DELETE:
 
624
                last = &table->bins[ptr->hash % table->num_bins];
 
625
                for (; (tmp = *last) != 0; last = &tmp->next) {
 
626
                    if (ptr == tmp) {
 
627
                        tmp = ptr->fore;
 
628
                        *last = ptr->next;
 
629
                        REMOVE_ENTRY(table, ptr);
 
630
                        free(ptr);
 
631
                        if (ptr == tmp) return 0;
 
632
                        ptr = tmp;
 
633
                        break;
 
634
                    }
 
635
                }
 
636
            }
 
637
        } while (!end && table->head);
 
638
    }
 
639
    return 0;
 
640
}
 
641
 
 
642
int
 
643
st_reverse_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
 
644
{
 
645
    st_table_entry *ptr, **last, *tmp;
 
646
    enum st_retval retval;
 
647
    int i, end;
 
648
 
 
649
    if (table->entries_packed) {
 
650
        for (i = table->num_entries-1; 0 <= i; i--) {
 
651
            int j;
 
652
            st_data_t key, val;
 
653
            key = (st_data_t)table->bins[i*2];
 
654
            val = (st_data_t)table->bins[i*2+1];
 
655
            retval = (*func)(key, val, arg);
 
656
            switch (retval) {
 
657
              case ST_CHECK:    /* check if hash is modified during iteration */
 
658
                for (j = 0; j < table->num_entries; j++) {
 
659
                    if ((st_data_t)table->bins[j*2] == key)
 
660
                        break;
 
661
                }
 
662
                if (j == table->num_entries) {
 
663
                    /* call func with error notice */
 
664
                    retval = (*func)(0, 0, arg, 1);
 
665
                    return 1;
 
666
                }
 
667
                /* fall through */
 
668
              case ST_CONTINUE:
 
669
                break;
 
670
              case ST_STOP:
 
671
                return 0;
 
672
              case ST_DELETE:
 
673
                table->num_entries--;
 
674
                memmove(&table->bins[i*2], &table->bins[(i+1)*2],
 
675
                        sizeof(struct st_table_entry*) * 2*(table->num_entries-i));
 
676
                break;
 
677
            }
 
678
        }
 
679
        return 0;
 
680
    }
 
681
 
 
682
    if ((ptr = table->head) != 0) {
 
683
        ptr = ptr->back;
 
684
        do {
 
685
            end = ptr == table->head;
 
686
            retval = (*func)(ptr->key, ptr->record, arg, 0);
 
687
            switch (retval) {
 
688
              case ST_CHECK:    /* check if hash is modified during iteration */
 
689
                i = ptr->hash % table->num_bins;
 
690
                for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) {
 
691
                    if (!tmp) {
 
692
                        /* call func with error notice */
 
693
                        retval = (*func)(0, 0, arg, 1);
 
694
                        return 1;
 
695
                    }
 
696
                }
 
697
                /* fall through */
 
698
              case ST_CONTINUE:
 
699
                ptr = ptr->back;
 
700
                break;
 
701
              case ST_STOP:
 
702
                return 0;
 
703
              case ST_DELETE:
 
704
                last = &table->bins[ptr->hash % table->num_bins];
 
705
                for (; (tmp = *last) != 0; last = &tmp->next) {
 
706
                    if (ptr == tmp) {
 
707
                        tmp = ptr->back;
 
708
                        *last = ptr->next;
 
709
                        REMOVE_ENTRY(table, ptr);
 
710
                        free(ptr);
 
711
                        ptr = tmp;
 
712
                        break;
 
713
                    }
487
714
                }
488
715
                ptr = ptr->next;
489
716
                free(tmp);
490
717
                table->num_entries--;
491
718
            }
492
 
        }
 
719
        } while (!end && table->head);
493
720
    }
494
721
    return 0;
495
722
}
497
724
/*
498
725
 * hash_32 - 32 bit Fowler/Noll/Vo FNV-1a hash code
499
726
 *
500
 
 * @(#) $Revision: 11708 $
501
 
 * @(#) $Id: st.c 11708 2007-02-12 23:01:19Z shyouhei $
 
727
 * @(#) $Revision: 13299 $
 
728
 * @(#) $Id: st.c 13299 2007-08-29 02:36:54Z akr $
502
729
 * @(#) $Source: /src/ruby/st.c,v $
503
730
 *
504
731
 ***