aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRalf S. Engelschall <rse@FreeBSD.org>2009-06-01 10:50:17 +0000
committerRalf S. Engelschall <rse@FreeBSD.org>2009-06-01 10:50:17 +0000
commitac08b882509e9f46241097df55edbce22e7f7646 (patch)
treec4cf7e9300fd6592d71d06e3217c88c7bf2ac864 /bin
parentd4b5cae49bff736c08586be8199e09a511ca711b (diff)
downloadsrc-ac08b882509e9f46241097df55edbce22e7f7646.tar.gz
src-ac08b882509e9f46241097df55edbce22e7f7646.zip
be more type correct and align local ckmalloc() with its underlying malloc(3) by using a "size_t" instead of an "int" argument
Notes
Notes: svn path=/head/; revision=193221
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/alias.c2
-rw-r--r--bin/sh/memalloc.c2
-rw-r--r--bin/sh/memalloc.h4
-rw-r--r--bin/sh/mkinit.c4
4 files changed, 7 insertions, 5 deletions
diff --git a/bin/sh/alias.c b/bin/sh/alias.c
index ea7ce55c598b..2edfe95eb459 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 115eea03df7b..fa03632f6861 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 347544211f51..4652e5411593 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 b158b5f6f745..022eed4eafc4 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;