Changeset 102a729 in mainline for uspace/lib/posix/stdlib.c
- Timestamp:
- 2011-07-20T19:43:22Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4cf8ca6
- Parents:
- 087c8798
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/stdlib.c
r087c8798 r102a729 40 40 41 41 #include "errno.h" 42 #include "limits.h" 42 43 43 44 #include "libc/sort.h" … … 138 139 { 139 140 int (*compare)(const void *, const void *) = userdata; 140 return compare(elem1, elem2); 141 int ret = compare(elem1, elem2); 142 143 /* Native qsort internals expect this. */ 144 if (ret < 0) { 145 return -1; 146 } else if (ret > 0) { 147 return 1; 148 } else { 149 return 0; 150 } 141 151 } 142 152 … … 353 363 void *posix_realloc(void *ptr, size_t size) 354 364 { 355 return realloc(ptr, size); 365 if (ptr != NULL && size == 0) { 366 /* Native realloc does not handle this special case. */ 367 free(ptr); 368 return NULL; 369 } else { 370 return realloc(ptr, size); 371 } 356 372 } 357 373
Note:
See TracChangeset
for help on using the changeset viewer.