aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2004-10-23 19:13:26 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2004-10-23 19:13:26 +0000
commitf27cf670a8729e84799f86c25401fe1be5cd2e51 (patch)
treeb545725767b1783c3ee8d65e2a6d711e1a0debbb /gdb/ada-lang.c
parent0fd555c412ecfb816f441dce78a3f288c49eb8e5 (diff)
downloadgdb-f27cf670a8729e84799f86c25401fe1be5cd2e51.zip
gdb-f27cf670a8729e84799f86c25401fe1be5cd2e51.tar.gz
gdb-f27cf670a8729e84799f86c25401fe1be5cd2e51.tar.bz2
* ada-lang.c (grow_vect): Return the new array instead of
expecting pointer to pointer to avoid violation of aliasing rules. * ada-lang.h (GROW_VECT): Adapt call to grow_vect.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 275e3a0..00e61a4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -319,20 +319,21 @@ extract_string (CORE_ADDR addr, char *buf)
while (buf[char_index - 1] != '\000');
}
-/* Assuming *OLD_VECT points to an array of *SIZE objects of size
+/* Assuming VECT points to an array of *SIZE objects of size
ELEMENT_SIZE, grow it to contain at least MIN_SIZE objects,
- updating *OLD_VECT and *SIZE as necessary. */
+ updating *SIZE as necessary and returning the (new) array. */
-void
-grow_vect (void **old_vect, size_t * size, size_t min_size, int element_size)
+void *
+grow_vect (void *vect, size_t *size, size_t min_size, int element_size)
{
if (*size < min_size)
{
*size *= 2;
if (*size < min_size)
*size = min_size;
- *old_vect = xrealloc (*old_vect, *size * element_size);
+ vect = xrealloc (vect, *size * element_size);
}
+ return vect;
}
/* True (non-zero) iff TARGET matches FIELD_NAME up to any trailing