This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 03/14] Change find_pcs_for_symtab_line to return a std::vector


On 2017-04-08 16:11, Tom Tromey wrote:
This changes find_pcs_for_symtab_line to return a std::vector.  This
allows the removal of some cleanups.

LGTM, just one suggestion.

diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
index 8d17aab..6c9350a 100644
--- a/gdb/python/py-linetable.c
+++ b/gdb/python/py-linetable.c
@@ -122,23 +122,23 @@ build_linetable_entry (int line, CORE_ADDR address)
    address.  */

 static PyObject *
-build_line_table_tuple_from_pcs (int line, VEC (CORE_ADDR) *vec)
+build_line_table_tuple_from_pcs (int line, const std::vector<CORE_ADDR> &vec)
 {
-  int vec_len = 0;
-  CORE_ADDR pc;
+  int vec_len;

I'd suggest removing vec_len and using vec.size() everywhere, instead of a mix of both. And feel free to rename the "vec" variable name to "pcs" :).

Thanks,

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]