Changeset 2156
- Timestamp:
- Jul 3, 2005, 12:03:14 AM (20 years ago)
- Location:
- trunk/src/emx/src/lib/malloc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/malloc/irealloc.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r2155 r2156 10 10 #include <sys/fmutex.h> 11 11 #include <emx/umalloc.h> 12 #include <errno.h> 12 13 13 14 static void *_um_crumb_expand (struct _um_crate *crate, … … 297 298 struct _um_hdr *hdr; 298 299 _umagic *parent; 300 void *ret; 299 301 300 302 if (block == NULL) … … 310 312 { 311 313 _um_abort ("Tried to free block twice! (realloc)"); 314 errno = EINVAL; 312 315 return NULL; 313 } 316 } 314 317 parent = _PTR_FROM_UMINT (hdr->parent, _umagic); 315 318 switch (*parent) 316 319 { 317 320 case _UM_MAGIC_CRATE: 318 ret urn_um_crumb_realloc ((struct _um_crate *)parent,319 320 321 ret = _um_crumb_realloc ((struct _um_crate *)parent, 322 _UM_CRUMB_FROM_BLOCK (block), new_size, 323 align, flags); 321 324 break; 325 322 326 case _UM_MAGIC_SEG: 323 return _um_lump_realloc ((struct _um_seg *)parent, 324 _UM_LUMP_FROM_BLOCK (block), new_size, 325 align, flags); 327 ret = _um_lump_realloc ((struct _um_seg *)parent, 328 _UM_LUMP_FROM_BLOCK (block), new_size, 329 align, flags); 330 break; 331 326 332 default: 327 333 { 328 334 _um_abort ("Corrupt heap or passing wrong pointer to realloc! (bad parent magic)"); 335 errno = EINVAL; 329 336 return NULL; 330 337 } 331 338 } 332 } 339 if (ret) 340 return ret; 341 errno = ENOMEM; 342 return NULL; 343 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/umalloc.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r2155 r2156 9 9 #include <sys/fmutex.h> 10 10 #include <emx/umalloc.h> 11 #include <errno.h> 11 12 12 13 void *_umalloc (Heap_t h, size_t size) … … 18 19 assert (h->magic == _UM_MAGIC_HEAP); 19 20 if (h->magic != _UM_MAGIC_HEAP) 20 return NULL; 21 { 22 errno = EINVAL; 23 return NULL; 24 } 21 25 22 26 _um_heap_lock (h); … … 26 30 block = _um_alloc_no_lock (h, size, align, flags); 27 31 _um_heap_unlock (h); 28 return block; 32 if (block) 33 return block; 34 errno = ENOMEM; 35 return NULL; 29 36 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.