Clean up gcc-4.3 warnings

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10971 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-12-07 10:57:43 +00:00
commit 3054ed120a
3 changed files with 7 additions and 3 deletions

View file

@ -157,7 +157,9 @@ static const char *tmp_string(void)
gethostname(hostname, sizeof(hostname)-1);
#endif
hostname[sizeof(hostname)-1] = 0;
asprintf(&ret, "%s.%u", hostname, (unsigned)getpid());
if (asprintf(&ret, "%s.%u", hostname, (unsigned)getpid()) == -1) {
fatal("could not allocate tmp_string");
}
}
return ret;

View file

@ -91,7 +91,7 @@ static void write_stats(int fd, unsigned counters[STATS_END])
if (len >= (int)sizeof(buf)-1) fatal("stats too long?!");
lseek(fd, 0, SEEK_SET);
write(fd, buf, len);
if (write(fd, buf, len) == -1) fatal("could not write stats");
}

View file

@ -442,7 +442,9 @@ void x_asprintf(char **ptr, const char *format, ...)
*ptr = NULL;
va_start(ap, format);
vasprintf(ptr, format, ap);
if (vasprintf(ptr, format, ap) == -1) {
fatal("out of memory in x_asprintf");
}
va_end(ap);
if (!ptr) fatal("out of memory in x_asprintf");