Lines Matching refs:bucket

57         ds_htable_bucket_t *bucket = table->buckets;  in ds_htable_rehash()  local
61 DS_HTABLE_BUCKET_REHASH(table, bucket, mask, index); in ds_htable_rehash()
62 bucket++; in ds_htable_rehash()
68 if (DS_HTABLE_BUCKET_DELETED(bucket)) { in ds_htable_rehash()
70 ds_htable_bucket_t *q = bucket; in ds_htable_rehash()
73 if ( ! DS_HTABLE_BUCKET_DELETED(++bucket)) { in ds_htable_rehash()
74 *q = *bucket; in ds_htable_rehash()
85 DS_HTABLE_BUCKET_REHASH(table, bucket, mask, index); in ds_htable_rehash()
86 bucket++; in ds_htable_rehash()
204 static inline bool ds_htable_bucket_key_match(ds_htable_bucket_t *bucket, zval *key) in ds_htable_bucket_key_match() argument
206 return key_is_identical(&bucket->key, key); in ds_htable_bucket_key_match()
344 ds_htable_bucket_t *bucket; in ds_htable_lookup_bucket_by_hash() local
353 index = DS_HTABLE_BUCKET_NEXT(bucket) in ds_htable_lookup_bucket_by_hash()
355 bucket = &table->buckets[index]; in ds_htable_lookup_bucket_by_hash()
357 if (DS_HTABLE_BUCKET_HASH(bucket) == hash) { in ds_htable_lookup_bucket_by_hash()
358 if (ds_htable_bucket_key_match(bucket, key)) { in ds_htable_lookup_bucket_by_hash()
359 return bucket; in ds_htable_lookup_bucket_by_hash()
384 ds_htable_bucket_t *bucket; in ds_htable_lookup_by_position() local
394 bucket = &table->buckets[index]; in ds_htable_lookup_by_position()
399 for (; bucket < stop; ++bucket) { in ds_htable_lookup_by_position()
400 if (DS_HTABLE_BUCKET_DELETED(bucket)) { in ds_htable_lookup_by_position()
405 return bucket; in ds_htable_lookup_by_position()
417 ds_htable_bucket_t *bucket; in ds_htable_lookup_by_value() local
419 DS_HTABLE_FOREACH_BUCKET(table, bucket) { in ds_htable_lookup_by_value()
420 if (zend_is_identical(value, &bucket->value)) { in ds_htable_lookup_by_value()
421 return bucket; in ds_htable_lookup_by_value()
431 ds_htable_bucket_t *bucket = ds_htable_lookup_by_key(table, key); in ds_htable_isset() local
433 return bucket && ds_zval_isset(&bucket->value, check_empty); in ds_htable_isset()
438 ds_htable_bucket_t *bucket = ds_htable_lookup_by_key(table, key); in ds_htable_get() local
440 return bucket ? &bucket->value : NULL; in ds_htable_get()
477 ds_htable_bucket_t *bucket; in ds_htable_clear_buffer() local
483 DS_HTABLE_FOREACH_BUCKET(table, bucket) { in ds_htable_clear_buffer()
484 DS_HTABLE_BUCKET_DELETE(bucket); in ds_htable_clear_buffer()
641 static void ds_htable_put_distinct_bucket(ds_htable_t *table, ds_htable_bucket_t *bucket) in ds_htable_put_distinct_bucket() argument
645 DS_HTABLE_BUCKET_COPY(next, bucket); in ds_htable_put_distinct_bucket()
662 ds_htable_bucket_t *bucket = &table->buckets[table->next]; in ds_htable_init_next_bucket() local
664 DS_HTABLE_BUCKET_HASH(bucket) = hash; in ds_htable_init_next_bucket()
665 DS_HTABLE_BUCKET_REHASH(table, bucket, table->capacity - 1, table->next); in ds_htable_init_next_bucket()
666 ZVAL_COPY(&bucket->key, key); in ds_htable_init_next_bucket()
670 ZVAL_COPY(&bucket->value, value); in ds_htable_init_next_bucket()
672 ZVAL_NULL(&bucket->value); in ds_htable_init_next_bucket()
677 return bucket; in ds_htable_init_next_bucket()
680 bool ds_htable_lookup_or_next(ds_htable_t *table, zval *key, ds_htable_bucket_t **bucket) in ds_htable_lookup_or_next() argument
685 if ((*bucket = ds_htable_lookup_bucket_by_hash(table, key, hash))) { in ds_htable_lookup_or_next()
694 *bucket = ds_htable_init_next_bucket(table, key, NULL, hash); in ds_htable_lookup_or_next()
700 ds_htable_bucket_t *bucket; in ds_htable_put() local
703 bool found = ds_htable_lookup_or_next(table, key, &bucket); in ds_htable_put()
707 DTOR_AND_UNDEF(&bucket->value); in ds_htable_put()
710 ZVAL_COPY(&bucket->value, value); in ds_htable_put()
734 ds_htable_bucket_t *bucket = &table->buckets[table->next - 1]; in ds_htable_last() local
735 while (DS_HTABLE_BUCKET_DELETED(bucket)) { in ds_htable_last()
736 bucket--; in ds_htable_last()
739 return bucket; in ds_htable_last()
749 ds_htable_bucket_t *bucket = table->buckets; in ds_htable_first() local
750 while (DS_HTABLE_BUCKET_DELETED(bucket)) { in ds_htable_first()
751 bucket++; in ds_htable_first()
754 return bucket; in ds_htable_first()
801 ds_htable_bucket_t *bucket = NULL; in ds_htable_remove() local
804 for (; index != DS_HTABLE_INVALID_INDEX; index = DS_HTABLE_BUCKET_NEXT(bucket)) { in ds_htable_remove()
805 bucket = &table->buckets[index]; in ds_htable_remove()
807 if (DS_HTABLE_BUCKET_HASH(bucket) != hash || ! ds_htable_bucket_key_match(bucket, key)) { in ds_htable_remove()
808 prev = bucket; in ds_htable_remove()
813 ZVAL_COPY(return_value, &bucket->value); in ds_htable_remove()
819 DS_HTABLE_BUCKET_LOOKUP(table, hash) = DS_HTABLE_BUCKET_NEXT(bucket); in ds_htable_remove()
821 DS_HTABLE_BUCKET_NEXT(prev) = DS_HTABLE_BUCKET_NEXT(bucket); in ds_htable_remove()
824 DS_HTABLE_BUCKET_DELETE(bucket); in ds_htable_remove()
831 bucket--; in ds_htable_remove()
833 while (DS_HTABLE_BUCKET_DELETED(bucket)); in ds_htable_remove()
935 ds_htable_bucket_t *bucket; in ds_htable_apply() local
937 DS_HTABLE_FOREACH_BUCKET(table, bucket) { in ds_htable_apply()
939 fci.params = (zval*) bucket; in ds_htable_apply()
946 zval_ptr_dtor(&bucket->value); in ds_htable_apply()
947 ZVAL_COPY_VALUE(&bucket->value, &retval); in ds_htable_apply()
954 ds_htable_bucket_t *bucket; in ds_htable_map() local
959 DS_HTABLE_FOREACH_BUCKET(table, bucket) { in ds_htable_map()
961 fci.params = (zval*) bucket; in ds_htable_map()
971 mapped, &bucket->key, &retval, DS_HTABLE_BUCKET_HASH(bucket)); in ds_htable_map()
982 ds_htable_bucket_t *bucket; in ds_htable_filter() local
985 DS_HTABLE_FOREACH_BUCKET(table, bucket) { in ds_htable_filter()
986 if (zend_is_true(&bucket->value)) { in ds_htable_filter()
989 &bucket->key, in ds_htable_filter()
990 &bucket->value, in ds_htable_filter()
991 DS_HTABLE_BUCKET_HASH(bucket)); in ds_htable_filter()
1064 ds_htable_bucket_t *bucket; in ds_htable_xor() local
1067 DS_HTABLE_FOREACH_BUCKET(table, bucket) { in ds_htable_xor()
1068 if ( ! ds_htable_has_key(other, &bucket->key)) { in ds_htable_xor()
1069 ds_htable_put_distinct_bucket(xor, bucket); in ds_htable_xor()
1074 DS_HTABLE_FOREACH_BUCKET(other, bucket) { in ds_htable_xor()
1075 if ( ! ds_htable_has_key(table, &bucket->key)) { in ds_htable_xor()
1076 ds_htable_put_distinct_bucket(xor, bucket); in ds_htable_xor()
1086 ds_htable_bucket_t *bucket; in ds_htable_diff() local
1089 DS_HTABLE_FOREACH_BUCKET(table, bucket) { in ds_htable_diff()
1090 if ( ! ds_htable_has_key(other, &bucket->key)) { in ds_htable_diff()
1091 ds_htable_put_distinct_bucket(diff, bucket); in ds_htable_diff()
1101 ds_htable_bucket_t *bucket; in ds_htable_intersect() local
1105 DS_HTABLE_FOREACH_BUCKET(table, bucket) { in ds_htable_intersect()
1106 if (ds_htable_has_key(other, &bucket->key)) { in ds_htable_intersect()
1107 ds_htable_put_distinct_bucket(intersection, bucket); in ds_htable_intersect()
1117 ds_htable_bucket_t *bucket; in ds_htable_merge() local
1120 DS_HTABLE_FOREACH_BUCKET(other, bucket) { in ds_htable_merge()
1121 ds_htable_put(merged, &bucket->key, &bucket->value); in ds_htable_merge()