Bug 979887: Fix GCC warnings about inline variable declarations, r=glandium

Some code is compiled in C90 mode, where inline declarations of
variables are not allowed.
This commit is contained in:
Thomas Zimmermann 2014-03-06 11:19:57 +01:00
parent 3cd708be15
commit 1a335a7c9c
2 changed files with 11 additions and 6 deletions

View File

@ -94,24 +94,27 @@ strdup_impl(const char *src)
MOZ_MEMORY_API int
vasprintf_impl(char **str, const char *fmt, va_list ap)
{
char* ptr, *_ptr;
int ret;
if (str == NULL || fmt == NULL) {
return -1;
}
char* ptr = (char*)malloc_impl(128);
ptr = (char*)malloc_impl(128);
if (ptr == NULL) {
*str = NULL;
return -1;
}
int ret = vsnprintf(ptr, 128, fmt, ap);
ret = vsnprintf(ptr, 128, fmt, ap);
if (ret < 0) {
free_impl(ptr);
*str = NULL;
return -1;
}
char* _ptr = realloc_impl(ptr, ret + 1);
_ptr = realloc_impl(ptr, ret + 1);
if (_ptr == NULL) {
free_impl(ptr);
*str = NULL;
@ -125,11 +128,12 @@ vasprintf_impl(char **str, const char *fmt, va_list ap)
MOZ_MEMORY_API int
asprintf_impl(char **str, const char *fmt, ...)
{
{
int ret;
va_list ap;
va_start(ap, fmt);
int ret = vasprintf_impl(str, fmt, ap);
ret = vasprintf_impl(str, fmt, ap);
va_end(ap);

View File

@ -2714,10 +2714,11 @@ RETURN:
static void *
pages_trim(void *addr, size_t alloc_size, size_t leadsize, size_t size)
{
size_t trailsize;
void *ret = (void *)((uintptr_t)addr + leadsize);
assert(alloc_size >= leadsize + size);
size_t trailsize = alloc_size - leadsize - size;
trailsize = alloc_size - leadsize - size;
if (leadsize != 0)
pages_unmap(addr, leadsize);