From 5f27d9125c71b42c653911b9a1eccf0b64a29d78 Mon Sep 17 00:00:00 2001 From: "ted.mielczarek" Date: Tue, 25 Nov 2008 13:41:41 +0000 Subject: Followup to address some review comments from Issue 259 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@297 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/linux/dump_symbols.cc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/common/linux/dump_symbols.cc') diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc index 9552109d..36cd6d85 100644 --- a/src/common/linux/dump_symbols.cc +++ b/src/common/linux/dump_symbols.cc @@ -328,12 +328,14 @@ static bool CompareAddress(T1 *a, T2 *b) { // Sort the array into increasing ordered array based on the virtual address. // Return vector of pointers to the elements in the incoming array. So caller // should make sure the returned vector lives longer than the incoming vector. -template -static std::vector SortByAddress(std::list *array) { - typedef typename std::list::iterator It; +template +static std::vector SortByAddress( + Container *container) { + typedef typename Container::iterator It; + typedef typename Container::value_type T; std::vector sorted_array_ptr; - sorted_array_ptr.reserve(array->size()); - for (It it = array -> begin(); it != array -> end(); it++) + sorted_array_ptr.reserve(container->size()); + for (It it = container->begin(); it != container->end(); it++) sorted_array_ptr.push_back(&(*it)); std::sort(sorted_array_ptr.begin(), sorted_array_ptr.end(), @@ -379,7 +381,8 @@ static ElfW(Addr) NextAddress( static int FindFileByNameIdx(uint32_t name_index, SourceFileInfoList &files) { - for (SourceFileInfoList::iterator it = files.begin(); it != files.end(); it++) { + for (SourceFileInfoList::iterator it = files.begin(); + it != files.end(); it++) { if (it->name_index == name_index) return it->source_id; } @@ -391,7 +394,8 @@ static int FindFileByNameIdx(uint32_t name_index, // Also fix the source id for the line info. static void AddIncludedFiles(struct SymbolInfo *symbols, const ElfW(Shdr) *stabstr_section) { - for (SourceFileInfoList::iterator source_file_it = symbols->source_file_info.begin(); + for (SourceFileInfoList::iterator source_file_it = + symbols->source_file_info.begin(); source_file_it != symbols->source_file_info.end(); ++source_file_it) { struct SourceFileInfo &source_file = *source_file_it; @@ -624,7 +628,8 @@ static bool WriteModuleInfo(int fd, } static bool WriteSourceFileInfo(int fd, const struct SymbolInfo &symbols) { - for (SourceFileInfoList::const_iterator it = symbols.source_file_info.begin(); + for (SourceFileInfoList::const_iterator it = + symbols.source_file_info.begin(); it != symbols.source_file_info.end(); it++) { if (it->source_id != -1) { const char *name = it->name; @@ -668,7 +673,8 @@ static bool WriteOneFunction(int fd, } static bool WriteFunctionInfo(int fd, const struct SymbolInfo &symbols) { - for (SourceFileInfoList::const_iterator it = symbols.source_file_info.begin(); + for (SourceFileInfoList::const_iterator it = + symbols.source_file_info.begin(); it != symbols.source_file_info.end(); it++) { const struct SourceFileInfo &file_info = *it; for (FuncInfoList::const_iterator fiIt = file_info.func_info.begin(); -- cgit v1.2.1