summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-17 09:24:18 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-17 09:42:11 -0700
commit4945a09e914c48a2a55dacdb24ffe2806378641b (patch)
tree6901cc24ca49ad9d01b42e5fd15fd23211707939
parent8c0dfb819569baf3c388bf9915fea1d332a29908 (diff)
Make Emalloc() argument a size_t to match malloc()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--imake.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/imake.c b/imake.c
index 59a520a..62e73eb 100644
--- a/imake.c
+++ b/imake.c
@@ -327,7 +327,7 @@ const char *FindImakefile(const char *Imakefile);
char *ReadLine(FILE *tmpfd, const char *tmpfname);
const char *CleanCppInput(const char *imakefile);
char *Strdup(const char *cp);
-char *Emalloc(int size);
+char *Emalloc(size_t size);
void LogFatal(const char *x0, ...) _X_ATTRIBUTE_PRINTF(1, 2);
void LogMsg(const char *x0, ...) _X_ATTRIBUTE_PRINTF(1, 2);
@@ -1745,7 +1745,7 @@ CleanCppInput(const char *imakefile)
LogFatal("Cannot open %s for input.", imakefile);
if (fstat(fileno(inFile), &st) < 0)
LogFatal("Cannot stat %s for size.", imakefile);
- buf = Emalloc((int)st.st_size+3);
+ buf = Emalloc(st.st_size + 3);
count = fread(buf + 2, 1, st.st_size, inFile);
if (count == 0 && st.st_size != 0)
LogFatal("Cannot read %s:", imakefile);
@@ -1967,7 +1967,7 @@ ReadLine(FILE *tmpfd, const char *tmpfname)
fseek(tmpfd, 0, SEEK_SET);
if (fstat(fileno(tmpfd), &st) < 0)
LogFatal("cannot stat %s for size", tmpMakefile);
- pline = buf = Emalloc((int)st.st_size+1);
+ pline = buf = Emalloc(st.st_size + 1);
total_red = fread(buf, 1, st.st_size, tmpfd);
if (total_red == 0 && st.st_size != 0)
LogFatal("cannot read %s", tmpMakefile);
@@ -2029,12 +2029,12 @@ writetmpfile(FILE *fd, const char *buf, size_t cnt, const char *fname)
}
char *
-Emalloc(int size)
+Emalloc(size_t size)
{
char *p;
if ((p = malloc(size)) == NULL)
- LogFatal("Cannot allocate %d bytes", size);
+ LogFatal("Cannot allocate %ld bytes", (long) size);
return(p);
}
@@ -2158,7 +2158,7 @@ char*
CrossCompileCPP(void)
{
char *cpp, *c;
- int len ;
+ size_t len;
if (crosscompile_use_cc_e)
AddCppArg("-E");