aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2018-03-30 17:18:56 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2018-03-30 17:18:56 -0400
commitd8611974cf819e5f8cb9eb36907251f3e2d721c6 (patch)
tree6f2a14e0ee4a7831ed5a9688dab2f8ba56052b19 /gdb
parent17d08cd4137063dbc43d9989b9a5cb315171174f (diff)
downloadgdb-d8611974cf819e5f8cb9eb36907251f3e2d721c6.zip
gdb-d8611974cf819e5f8cb9eb36907251f3e2d721c6.tar.gz
gdb-d8611974cf819e5f8cb9eb36907251f3e2d721c6.tar.bz2
Remove usage of VEC(char_ptr) in gdbscm_parse_function_args
This is a straightforward replacement, no change in behavior are intended/expected. This is the last usage of VEC(char_ptr), so it can now be removed. gdb/ChangeLog: * guile/scm-utils.c (gdbscm_parse_function_args): Replace VEC with std::vector. * common/gdb_vecs.h (DEF_VEC_P (char_ptr)): Remove.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/common/gdb_vecs.h2
-rw-r--r--gdb/guile/scm-utils.c13
3 files changed, 10 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f96adf7..148b187 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2018-03-30 Simon Marchi <simon.marchi@polymtl.ca>
+ * guile/scm-utils.c (gdbscm_parse_function_args): Replace VEC
+ with std::vector.
+ * common/gdb_vecs.h (DEF_VEC_P (char_ptr)): Remove.
+
+2018-03-30 Simon Marchi <simon.marchi@polymtl.ca>
+
* tracepoint.h (struct uploaded_tp): Initialize fields.
<actions, step_actions, cmd_strings>: Change type to
std::vector<char *>.
diff --git a/gdb/common/gdb_vecs.h b/gdb/common/gdb_vecs.h
index 7318e53..8bb7015 100644
--- a/gdb/common/gdb_vecs.h
+++ b/gdb/common/gdb_vecs.h
@@ -25,8 +25,6 @@
typedef char *char_ptr;
typedef const char *const_char_ptr;
-DEF_VEC_P (char_ptr);
-
DEF_VEC_P (const_char_ptr);
/* Split STR, a list of DELIMITER-separated fields, into a char pointer vector.
diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c
index c31afc6..73b0dec 100644
--- a/gdb/guile/scm-utils.c
+++ b/gdb/guile/scm-utils.c
@@ -386,7 +386,7 @@ gdbscm_parse_function_args (const char *func_name,
SCM status;
SCM rest = SCM_EOL;
/* Keep track of malloc'd strings. We need to free them upon error. */
- VEC (char_ptr) *allocated_strings = NULL;
+ std::vector<char *> allocated_strings;
char *ptr;
have_rest = validate_arg_format (format);
@@ -419,7 +419,7 @@ gdbscm_parse_function_args (const char *func_name,
if (!gdbscm_is_false (status))
goto fail;
if (*p == 's')
- VEC_safe_push (char_ptr, allocated_strings, *(char **) arg_ptr);
+ allocated_strings.push_back (*(char **) arg_ptr);
}
++p;
++position;
@@ -485,10 +485,7 @@ gdbscm_parse_function_args (const char *func_name,
if (!gdbscm_is_false (status))
goto fail;
if (p[i] == 's')
- {
- VEC_safe_push (char_ptr, allocated_strings,
- *(char **) arg_ptr);
- }
+ allocated_strings.push_back (*(char **) arg_ptr);
}
}
}
@@ -516,14 +513,12 @@ gdbscm_parse_function_args (const char *func_name,
}
va_end (args);
- VEC_free (char_ptr, allocated_strings);
return;
fail:
va_end (args);
- for (i = 0; VEC_iterate (char_ptr, allocated_strings, i, ptr); ++i)
+ for (char *ptr : allocated_strings)
xfree (ptr);
- VEC_free (char_ptr, allocated_strings);
gdbscm_throw (status);
}