X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Fvec.c;h=078bcc636539891e25d35a9cbcfc01ca9d318217;hp=3e60580992d14d48c274638eda6d850ba0bd347d;hb=b22f66e203c5928a518440558634496a4ff1b391;hpb=8dc2823a2f3ba69e89bcb0189f9e2f95021f0cb6 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; }