Skip to content
Snippets Groups Projects
Commit cb694782 authored by Arne Goedeke's avatar Arne Goedeke
Browse files

allocator: add some function attributes

parent 44b03690
No related branches found
No related tags found
No related merge requests found
#include "stack_allocator.h"
MALLOC_FUNCTION
static struct chunk * alloc_chunk(size_t size) {
struct chunk * c = (struct chunk*)xalloc(sizeof(struct chunk) + size);
c->data = c->top = c + 1;
......
#include "global.h"
#include "pike_memory.h"
struct stack_allocator {
struct chunk * cur;
......@@ -31,6 +32,7 @@ static INLINE void sa_alloc_enlarge(struct stack_allocator * a, size_t size) {
stack_alloc_enlarge(a, size);
}
MALLOC_FUNCTION
static INLINE void * sa_alloc_fast(struct stack_allocator * a, size_t size) {
struct chunk * c = a->cur;
void * ret = c->top;
......@@ -38,6 +40,7 @@ static INLINE void * sa_alloc_fast(struct stack_allocator * a, size_t size) {
return ret;
}
MALLOC_FUNCTION
static INLINE void * sa_alloc(struct stack_allocator * a, size_t size) {
sa_alloc_enlarge(a, size);
return sa_alloc_fast(a, size);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment