be more type correct and align local ckmalloc() with its underlying malloc(3) by using a "size_t" instead of an "int" argument
This commit is contained in:
parent
d4b5cae49b
commit
ac08b88250
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=193221
@ -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 */
|
||||
|
@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
|
||||
*/
|
||||
|
||||
pointer
|
||||
ckmalloc(int nbytes)
|
||||
ckmalloc(size_t nbytes)
|
||||
{
|
||||
pointer p;
|
||||
|
||||
|
@ -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 *);
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user