diff options
author | rse <rse@FreeBSD.org> | 2009-06-01 10:50:17 +0000 |
---|---|---|
committer | rse <rse@FreeBSD.org> | 2009-06-01 10:50:17 +0000 |
commit | 88b5665aec3867f4281c38a6100590462cc8fa75 (patch) | |
tree | c4cf7e9300fd6592d71d06e3217c88c7bf2ac864 | |
parent | 2bab6955606e0d2046018b3a7a9f06775f06b145 (diff) | |
download | FreeBSD-src-88b5665aec3867f4281c38a6100590462cc8fa75.zip FreeBSD-src-88b5665aec3867f4281c38a6100590462cc8fa75.tar.gz |
be more type correct and align local ckmalloc() with its underlying malloc(3) by using a "size_t" instead of an "int" argument
-rw-r--r-- | bin/sh/alias.c | 2 | ||||
-rw-r--r-- | bin/sh/memalloc.c | 2 | ||||
-rw-r--r-- | bin/sh/memalloc.h | 4 | ||||
-rw-r--r-- | bin/sh/mkinit.c | 4 |
4 files changed, 7 insertions, 5 deletions
diff --git a/bin/sh/alias.c b/bin/sh/alias.c index ea7ce55..2edfe95 100644 --- a/bin/sh/alias.c +++ b/bin/sh/alias.c @@ -97,7 +97,7 @@ setalias(char *name, char *val) ap->val = savestr(val); #else /* hack */ { - int len = strlen(val); + size_t len = strlen(val); ap->val = ckmalloc(len + 2); memcpy(ap->val, val, len); ap->val[len] = ' '; /* fluff */ diff --git a/bin/sh/memalloc.c b/bin/sh/memalloc.c index 115eea0..fa03632 100644 --- a/bin/sh/memalloc.c +++ b/bin/sh/memalloc.c @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); */ pointer -ckmalloc(int nbytes) +ckmalloc(size_t nbytes) { pointer p; diff --git a/bin/sh/memalloc.h b/bin/sh/memalloc.h index 3475442..4652e54 100644 --- a/bin/sh/memalloc.h +++ b/bin/sh/memalloc.h @@ -33,6 +33,8 @@ * $FreeBSD$ */ +#include <string.h> + struct stackmark { struct stack_block *stackp; char *stacknxt; @@ -46,7 +48,7 @@ extern int stacknleft; extern int sstrnleft; extern int herefd; -pointer ckmalloc(int); +pointer ckmalloc(size_t); pointer ckrealloc(pointer, int); void ckfree(pointer); char *savestr(char *); diff --git a/bin/sh/mkinit.c b/bin/sh/mkinit.c index b158b5f..022eed4 100644 --- a/bin/sh/mkinit.c +++ b/bin/sh/mkinit.c @@ -159,7 +159,7 @@ void addstr(char *, struct text *); void addchar(int, struct text *); void writetext(struct text *, FILE *); FILE *ckfopen(char *, char *); -void *ckmalloc(int); +void *ckmalloc(size_t); char *savestr(char *); void error(char *); @@ -464,7 +464,7 @@ ckfopen(char *file, char *mode) } void * -ckmalloc(int nbytes) +ckmalloc(size_t nbytes) { char *p; |