summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--lib.c4
-rw-r--r--lib.h4
-rw-r--r--utf8.c2
4 files changed, 15 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a1c7c3ba..4c74ebef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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++
diff --git a/lib.c b/lib.c
index f2451ec1..ab1447fa 100644
--- a/lib.c
+++ b/lib.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)
diff --git a/lib.h b/lib.h
index a11888cc..f0ee023c 100644
--- a/lib.h
+++ b/lib.h
@@ -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 */
diff --git a/utf8.c b/utf8.c
index 46b1feae..56f533a2 100644
--- a/utf8.c
+++ b/utf8.c
@@ -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;
}