diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-06-07 11:23:53 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-06-07 11:23:53 +0000 |
commit | ed8b9b178780a0085e20908bcce9f2d9152107ca (patch) | |
tree | 03afd088d8cafb0a6c3e7f6ada91328a25b32e08 /mdk-stage1 | |
parent | 20db58e37e32316fa308d5f15d18248aca8ae43a (diff) | |
download | drakx-ed8b9b178780a0085e20908bcce9f2d9152107ca.tar drakx-ed8b9b178780a0085e20908bcce9f2d9152107ca.tar.gz drakx-ed8b9b178780a0085e20908bcce9f2d9152107ca.tar.bz2 drakx-ed8b9b178780a0085e20908bcce9f2d9152107ca.tar.xz drakx-ed8b9b178780a0085e20908bcce9f2d9152107ca.zip |
fix build with gcc 3.4 (+ little cleanup)
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/dietlibc/lib/alloc.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/mdk-stage1/dietlibc/lib/alloc.c b/mdk-stage1/dietlibc/lib/alloc.c index a2b3b73a1..9643913a6 100644 --- a/mdk-stage1/dietlibc/lib/alloc.c +++ b/mdk-stage1/dietlibc/lib/alloc.c @@ -44,14 +44,17 @@ typedef union { /* a simple mmap :) */ -#ifdef __i386__ /* regparm exists only on i386 */ -static void *do_mmap(size_t size) __attribute__((regparm(1))); -static size_t get_index(size_t _size) __attribute__((regparm(1))); -static void* __small_malloc(size_t _size) __attribute__((regparm(1))); +#ifdef __i386__ +#define REGPARM(n) __attribute__((regparm(n))) +#else +#define REGPARM(n) #endif +static size_t REGPARM(1) get_index(size_t _size); +static void* REGPARM(1) __small_malloc(size_t _size); + -static void *do_mmap(size_t size) { +static void REGPARM(1) *do_mmap(size_t size) { return mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, (size_t)0); } @@ -70,7 +73,7 @@ static __alloc_t* __small_mem[8]; static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; } -static size_t get_index(size_t _size) { +static size_t REGPARM(1) get_index(size_t _size) { register size_t idx=0; if (_size) { register size_t size=((_size-1)&(MEM_BLOCK_SIZE-1))>>__ind_shift(); @@ -80,9 +83,8 @@ static size_t get_index(size_t _size) { } /* small mem */ -static void __small_free(void*_ptr,size_t _size) __attribute__((regparm(2))); -static void __small_free(void*_ptr,size_t _size) { +static void REGPARM(2) __small_free(void*_ptr,size_t _size) { __alloc_t* ptr=BLOCK_START(_ptr); size_t size=_size; size_t idx=get_index(size); @@ -93,7 +95,7 @@ static void __small_free(void*_ptr,size_t _size) { __small_mem[idx]=ptr; } -static void* __small_malloc(size_t _size) { +static void* REGPARM(1) __small_malloc(size_t _size) { __alloc_t *ptr; size_t size=_size; size_t idx; |