add inline hints for slab_allocate and slab_free
parent
33f862ec19
commit
718bf82f96
4
malloc.c
4
malloc.c
|
@ -303,7 +303,7 @@ static void *slot_pointer(size_t size, void *slab, size_t slot) {
|
||||||
return (char *)slab + slot * size;
|
return (char *)slab + slot * size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *slab_allocate(size_t requested_size) {
|
static inline void *slab_allocate(size_t requested_size) {
|
||||||
struct size_info info = get_size_info(requested_size);
|
struct size_info info = get_size_info(requested_size);
|
||||||
size_t size = info.size;
|
size_t size = info.size;
|
||||||
struct size_class *c = &size_class_metadata[info.class];
|
struct size_class *c = &size_class_metadata[info.class];
|
||||||
|
@ -386,7 +386,7 @@ static size_t slab_usable_size(void *p) {
|
||||||
return size_classes[slab_size_class(p)];
|
return size_classes[slab_size_class(p)];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void slab_free(void *p) {
|
static inline void slab_free(void *p) {
|
||||||
size_t class = slab_size_class(p);
|
size_t class = slab_size_class(p);
|
||||||
|
|
||||||
struct size_class *c = &size_class_metadata[class];
|
struct size_class *c = &size_class_metadata[class];
|
||||||
|
|
Loading…
Reference in New Issue