Mercurial > hg > xemacs-beta
comparison src/ralloc.c @ 163:0132846995bd r20-3b8
Import from CVS: tag r20-3b8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:43:35 +0200 |
parents | 9f59509498e1 |
children | 3d6bfa290dbd |
comparison
equal
deleted
inserted
replaced
162:4de2936b4e77 | 163:0132846995bd |
---|---|
672 | 672 |
673 /* Get a new handle for a fresh block. */ | 673 /* Get a new handle for a fresh block. */ |
674 static MMAP_HANDLE | 674 static MMAP_HANDLE |
675 new_mmap_handle (size_t nsiz) | 675 new_mmap_handle (size_t nsiz) |
676 { | 676 { |
677 MMAP_HANDLE h = UNDERLYING_MALLOC( sizeof( struct alloc_dll ) ); | 677 MMAP_HANDLE h = (MMAP_HANDLE) UNDERLYING_MALLOC( sizeof (struct alloc_dll)); |
678 if ( h == 0) return 0; | 678 if ( h == 0) return 0; |
679 h->size = nsiz; | 679 h->size = nsiz; |
680 if (mmap_start == 0) | 680 if (mmap_start == 0) |
681 { | 681 { |
682 init_MHASH_table (); | 682 init_MHASH_table (); |
1079 switch(r_alloc_initialized) | 1079 switch(r_alloc_initialized) |
1080 { | 1080 { |
1081 case 0: | 1081 case 0: |
1082 abort(); | 1082 abort(); |
1083 case 1: | 1083 case 1: |
1084 *ptr = UNDERLYING_MALLOC(size); | 1084 *ptr = (POINTER) UNDERLYING_MALLOC(size); |
1085 break; | 1085 break; |
1086 default: | 1086 default: |
1087 mh = new_mmap_handle( size ); | 1087 mh = new_mmap_handle( size ); |
1088 if (mh) | 1088 if (mh) |
1089 { | 1089 { |
1165 abort (); | 1165 abort (); |
1166 return 0; /* suppress compiler warning */ | 1166 return 0; /* suppress compiler warning */ |
1167 } | 1167 } |
1168 else if (r_alloc_initialized == 1) | 1168 else if (r_alloc_initialized == 1) |
1169 { | 1169 { |
1170 POINTER tmp = realloc(*ptr, sz); | 1170 POINTER tmp = (POINTER) realloc(*ptr, sz); |
1171 if (tmp) | 1171 if (tmp) |
1172 *ptr = tmp; | 1172 *ptr = tmp; |
1173 return tmp; | 1173 return tmp; |
1174 } | 1174 } |
1175 else | 1175 else |
1179 MMAP_HANDLE h = find_mmap_handle( ptr ); | 1179 MMAP_HANDLE h = find_mmap_handle( ptr ); |
1180 VM_ADDR new_vm_addr; | 1180 VM_ADDR new_vm_addr; |
1181 | 1181 |
1182 if ( h == 0 ) /* Was allocated using malloc. */ | 1182 if ( h == 0 ) /* Was allocated using malloc. */ |
1183 { | 1183 { |
1184 POINTER tmp = UNDERLYING_REALLOC(*ptr, sz); | 1184 POINTER tmp = (POINTER) UNDERLYING_REALLOC(*ptr, sz); |
1185 if (tmp) | 1185 if (tmp) |
1186 *ptr = tmp; | 1186 *ptr = tmp; |
1187 return tmp; | 1187 return tmp; |
1188 } | 1188 } |
1189 | 1189 |