bset.c (0898782247ae533d1f4e47a06bc5d4870931b284) | bset.c (06c1526da97dd0022973de3fc41b79b2d431b435) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Code for working with individual keys, and sorted sets of keys with in a 4 * btree node 5 * 6 * Copyright 2012 Google, Inc. 7 */ 8 --- 141 unchanged lines hidden (view full) --- 150 memcpy(new_keys, l->inline_keys, sizeof(uint64_t) * oldsize); 151 152 l->keys_p = new_keys; 153 l->top_p = new_keys + oldsize; 154 155 return 0; 156} 157 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Code for working with individual keys, and sorted sets of keys with in a 4 * btree node 5 * 6 * Copyright 2012 Google, Inc. 7 */ 8 --- 141 unchanged lines hidden (view full) --- 150 memcpy(new_keys, l->inline_keys, sizeof(uint64_t) * oldsize); 151 152 l->keys_p = new_keys; 153 l->top_p = new_keys + oldsize; 154 155 return 0; 156} 157 |
158/* Pop the top key of keylist by pointing l->top to its previous key */ |
|
158struct bkey *bch_keylist_pop(struct keylist *l) 159{ 160 struct bkey *k = l->keys; 161 162 if (k == l->top) 163 return NULL; 164 165 while (bkey_next(k) != l->top) 166 k = bkey_next(k); 167 168 return l->top = k; 169} 170 | 159struct bkey *bch_keylist_pop(struct keylist *l) 160{ 161 struct bkey *k = l->keys; 162 163 if (k == l->top) 164 return NULL; 165 166 while (bkey_next(k) != l->top) 167 k = bkey_next(k); 168 169 return l->top = k; 170} 171 |
172/* Pop the bottom key of keylist and update l->top_p */ |
|
171void bch_keylist_pop_front(struct keylist *l) 172{ 173 l->top_p -= bkey_u64s(l->keys); 174 175 memmove(l->keys, 176 bkey_next(l->keys), 177 bch_keylist_bytes(l)); 178} --- 1216 unchanged lines hidden --- | 173void bch_keylist_pop_front(struct keylist *l) 174{ 175 l->top_p -= bkey_u64s(l->keys); 176 177 memmove(l->keys, 178 bkey_next(l->keys), 179 bch_keylist_bytes(l)); 180} --- 1216 unchanged lines hidden --- |