#include "ggc.h"
#include "vec.h"
#include "coretypes.h"
-#include "toplev.h"
+#include "diagnostic-core.h"
#include "hashtab.h"
-struct vec_prefix
+struct vec_prefix
{
unsigned num;
unsigned alloc;
/* 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;
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;
bool exact MEM_STAT_DECL)
{
struct vec_prefix *pfx = (struct vec_prefix *) vec;
- unsigned alloc = alloc = calculate_allocation (pfx, reserve, exact);
-
+ 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;
}
if (vec)
free_overhead (pfx);
#endif
-
+
vec = xrealloc (vec, vec_offset + alloc * elt_size);
((struct vec_prefix *)vec)->alloc = alloc;
if (!pfx)
register_overhead ((struct vec_prefix *)vec,
vec_offset + alloc * elt_size PASS_MEM_STAT);
#endif
-
+
return vec;
}