diff options
author | Tim Kientzle <kientzle@FreeBSD.org> | 2006-11-10 06:39:46 +0000 |
---|---|---|
committer | Tim Kientzle <kientzle@FreeBSD.org> | 2006-11-10 06:39:46 +0000 |
commit | aa1eeda578151e40c41ef39dd198979d4bae29a5 (patch) | |
tree | f89881956f7ca553a6834444961e2cb90388cc29 /lib/libarchive/archive_string.c | |
parent | c25789cc22feeabda3263de28be3fdba48401e05 (diff) |
Portability and style fixes:
* Actually use the HAVE_<header>_H macros to conditionally include
system headers. They've been defined for a long time, but only
used in a few places. Now they're used pretty consistently
throughout.
* Fill in a lot of missing casts for conversions from void*.
Although Standard C doesn't require this, some people have been
trying to use C++ compilers with this code, and they do require it.
Bit-for-bit, the compiled object files are identical, except for
one assert() whose line number changed, so I'm pretty confident I
didn't break anything. ;-)
Notes
Notes:
svn path=/head/; revision=164142
Diffstat (limited to 'lib/libarchive/archive_string.c')
-rw-r--r-- | lib/libarchive/archive_string.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libarchive/archive_string.c b/lib/libarchive/archive_string.c index b18f31dbb66c..229a5cbc1f39 100644 --- a/lib/libarchive/archive_string.c +++ b/lib/libarchive/archive_string.c @@ -32,8 +32,12 @@ __FBSDID("$FreeBSD$"); * strings while minimizing heap activity. */ +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif #include "archive_private.h" #include "archive_string.h" @@ -67,7 +71,7 @@ __archive_string_ensure(struct archive_string *as, size_t s) as->buffer_length = 32; while (as->buffer_length < s) as->buffer_length *= 2; - as->s = realloc(as->s, as->buffer_length); + as->s = (char *)realloc(as->s, as->buffer_length); /* TODO: Return null instead and fix up all of our callers to * handle this correctly. */ if (as->s == NULL) |