diff options
Diffstat (limited to 'gcc/vec.c')
-rw-r--r-- | gcc/vec.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/vec.c b/gcc/vec.c index 3e60580992d..078bcc63653 100644 --- a/gcc/vec.c +++ b/gcc/vec.c @@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "toplev.h" #include "hashtab.h" -struct vec_prefix +struct vec_prefix { unsigned num; unsigned alloc; @@ -190,10 +190,10 @@ calculate_allocation (const struct vec_prefix *pfx, int reserve, bool exact) /* If there's no prefix, and we've not requested anything, then we will create a NULL vector. */ return 0; - + /* We must have run out of room. */ gcc_assert (alloc - num < (unsigned) reserve); - + if (exact) /* Exact size. */ alloc = num + reserve; @@ -208,7 +208,7 @@ calculate_allocation (const struct vec_prefix *pfx, int reserve, bool exact) else /* Grow slower when large. */ alloc = (alloc * 3 / 2); - + /* If this is still too small, set it to the right size. */ if (alloc < num + reserve) alloc = num + reserve; @@ -228,19 +228,19 @@ vec_gc_o_reserve_1 (void *vec, int reserve, size_t vec_offset, size_t elt_size, { struct vec_prefix *pfx = (struct vec_prefix *) vec; unsigned alloc = calculate_allocation (pfx, reserve, exact); - + if (!alloc) { if (pfx) ggc_free (pfx); return NULL; } - + vec = ggc_realloc_stat (vec, vec_offset + alloc * elt_size PASS_MEM_STAT); ((struct vec_prefix *)vec)->alloc = alloc; if (!pfx) ((struct vec_prefix *)vec)->num = 0; - + return vec; } @@ -316,7 +316,7 @@ vec_heap_o_reserve_1 (void *vec, int reserve, size_t vec_offset, if (vec) free_overhead (pfx); #endif - + vec = xrealloc (vec, vec_offset + alloc * elt_size); ((struct vec_prefix *)vec)->alloc = alloc; if (!pfx) @@ -326,7 +326,7 @@ vec_heap_o_reserve_1 (void *vec, int reserve, size_t vec_offset, register_overhead ((struct vec_prefix *)vec, vec_offset + alloc * elt_size PASS_MEM_STAT); #endif - + return vec; } |