diff options
| author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2015-04-28 16:28:29 +0000 |
|---|---|---|
| committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2015-04-28 16:28:29 +0000 |
| commit | e7884e61f437e6034bab7b56dea357735567bf41 (patch) | |
| tree | 1471f3c8d8bfd5bffe7b6295ab944f2f00b0ce5a /libcpp/line-map.c | |
| parent | d27994699127cfb0a68b75b378e706264c0441ec (diff) | |
Notes
Diffstat (limited to 'libcpp/line-map.c')
| -rw-r--r-- | libcpp/line-map.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libcpp/line-map.c b/libcpp/line-map.c index c95eacde7e3cd..c13a82dcafc95 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -1,5 +1,5 @@ /* Map logical line numbers to (source file, line number) pairs. - Copyright (C) 2001, 2003, 2004 + Copyright (C) 2001, 2003, 2004, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -96,8 +96,15 @@ linemap_add (struct line_maps *set, enum lc_reason reason, if (set->used == set->allocated) { + line_map_realloc reallocator + = set->reallocator ? set->reallocator : xrealloc; set->allocated = 2 * set->allocated + 256; - set->maps = XRESIZEVEC (struct line_map, set->maps, set->allocated); + set->maps + = (struct line_map *) (*reallocator) (set->maps, + set->allocated + * sizeof (struct line_map)); + memset (&set->maps[set->used], 0, ((set->allocated - set->used) + * sizeof (struct line_map))); } map = &set->maps[set->used]; |
