Skip to content

Commit b6181b6

Browse files
lplewabratpiorka
authored andcommitted
rename slab_Reg to pool_register_slab
this improves redability, and reduces "spaghetti" in the code Signed-off-by: Łukasz Plewa <[email protected]>
1 parent 6bb22d8 commit b6181b6

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/pool/pool_disjoint.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,7 @@ static bool slab_has_avail(const slab_t *slab) {
199199
return slab->num_chunks_allocated < slab->num_chunks_total;
200200
}
201201

202-
static umf_result_t slab_reg(slab_t *slab) {
203-
bucket_t *bucket = slab->bucket;
204-
disjoint_pool_t *pool = bucket->pool;
202+
static umf_result_t pool_register_slab(disjoint_pool_t *pool, slab_t *slab) {
205203
critnib *slabs = pool->known_slabs;
206204

207205
// NOTE: changed vs original DisjointPool implementation - currently slab
@@ -225,9 +223,7 @@ static umf_result_t slab_reg(slab_t *slab) {
225223
return res;
226224
}
227225

228-
static umf_result_t slab_unreg(slab_t *slab) {
229-
bucket_t *bucket = slab->bucket;
230-
disjoint_pool_t *pool = bucket->pool;
226+
static umf_result_t pool_unregister_slab(disjoint_pool_t *pool, slab_t *slab) {
231227
critnib *slabs = pool->known_slabs;
232228

233229
void *slab_addr = slab_get(slab);
@@ -305,7 +301,7 @@ static void bucket_free_chunk(bucket_t *bucket, void *ptr, slab_t *slab,
305301
// remove slab
306302
slab_list_item_t *slab_it = &slab->iter;
307303
assert(slab_it->val != NULL);
308-
slab_unreg(slab_it->val);
304+
pool_unregister_slab(bucket->pool, slab_it->val);
309305
DL_DELETE(bucket->available_slabs, slab_it);
310306
bucket->available_slabs_num--;
311307
destroy_slab(slab_it->val);
@@ -348,7 +344,7 @@ static slab_t *bucket_create_slab(bucket_t *bucket) {
348344
return NULL;
349345
}
350346

351-
umf_result_t res = slab_reg(slab);
347+
umf_result_t res = pool_register_slab(bucket->pool, slab);
352348
if (res != UMF_RESULT_SUCCESS) {
353349
LOG_ERR("slab_reg failed!")
354350
destroy_slab(slab);

0 commit comments

Comments
 (0)