diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | lib.c | 4 | ||||
-rw-r--r-- | lib.h | 4 | ||||
-rw-r--r-- | utf8.c | 2 |
4 files changed, 15 insertions, 5 deletions
@@ -1,3 +1,13 @@ +2009-11-19 Kaz Kylheku <kkylheku@gmail.com> + + Use unsigned char * as allocator return value. + + * lib.c (chk_malloc, chk_realloc): Return unsigned char *. + + * lib.c (chk_malloc, chk_realloc): Declarations updated. + + * utf8 (utf8_dup_to_uc): Remove cast to unsigned char *. + 2009-11-18 Kaz Kylheku <kkylheku@gmail.com> Following-up on diagnostics obtained by running code through C++ @@ -518,7 +518,7 @@ static obj_t *equal_tramp(obj_t *env, obj_t *left, obj_t *right) return equal(left, right); } -char *chk_malloc(size_t size) +unsigned char *chk_malloc(size_t size) { char *ptr = malloc(size); if (size && ptr == 0) @@ -526,7 +526,7 @@ char *chk_malloc(size_t size) return ptr; } -char *chk_realloc(void *old, size_t size) +unsigned char *chk_realloc(void *old, size_t size) { char *newptr = realloc(old, size); if (size != 0 && newptr == 0) @@ -222,8 +222,8 @@ obj_t *none_satisfy(obj_t *list, obj_t *pred, obj_t *key); long c_num(obj_t *num); obj_t *nump(obj_t *num); obj_t *equal(obj_t *left, obj_t *right); -char *chk_malloc(size_t size); -char *chk_realloc(void *, size_t size); +unsigned char *chk_malloc(size_t size); +unsigned char *chk_realloc(void *, size_t size); wchar_t *chk_strdup(const wchar_t *str); obj_t *cons(obj_t *car, obj_t *cdr); obj_t *list(obj_t *first, ...); /* terminated by nao */ @@ -169,7 +169,7 @@ wchar_t *utf8_dup_from(const char *str) unsigned char *utf8_dup_to_uc(const wchar_t *wstr) { size_t nbyte = utf8_to_uc(0, wstr); - unsigned char *str = (unsigned char *) chk_malloc(nbyte); + unsigned char *str = chk_malloc(nbyte); utf8_to_uc(str, wstr); return str; } |