From 09b056975dacd1f0f815ad820b6dc9913b0118a3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Jun 2020 18:55:43 -0400 Subject: fix pointer style to match the style guide We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine Reviewed-by: Mark Mentovai --- src/processor/basic_source_line_resolver.cc | 100 ++++++++++++++-------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'src/processor/basic_source_line_resolver.cc') diff --git a/src/processor/basic_source_line_resolver.cc b/src/processor/basic_source_line_resolver.cc index c4aa949c..64d40015 100644 --- a/src/processor/basic_source_line_resolver.cc +++ b/src/processor/basic_source_line_resolver.cc @@ -69,11 +69,11 @@ namespace { // field, and max_tokens is the maximum number of tokens including the optional // field. Refer to the documentation for Tokenize for descriptions of the other // arguments. -bool TokenizeWithOptionalField(char *line, - const char *optional_field, - const char *separators, +bool TokenizeWithOptionalField(char* line, + const char* optional_field, + const char* separators, int max_tokens, - vector *tokens) { + vector* tokens) { // First tokenize assuming the optional field is not present. If we then see // the optional field, additionally tokenize the last token into two tokens. if (!Tokenize(line, separators, max_tokens - 1, tokens)) { @@ -98,7 +98,7 @@ bool TokenizeWithOptionalField(char *line, } // namespace -static const char *kWhitespace = " \r\n"; +static const char* kWhitespace = " \r\n"; static const int kMaxErrorsPrinted = 5; static const int kMaxErrorsBeforeBailing = 100; @@ -107,9 +107,9 @@ BasicSourceLineResolver::BasicSourceLineResolver() : // static void BasicSourceLineResolver::Module::LogParseError( - const string &message, + const string& message, int line_number, - int *num_errors) { + int* num_errors) { if (++(*num_errors) <= kMaxErrorsPrinted) { if (line_number > 0) { BPLOG(ERROR) << "Line " << line_number << ": " << message; @@ -120,12 +120,12 @@ void BasicSourceLineResolver::Module::LogParseError( } bool BasicSourceLineResolver::Module::LoadMapFromMemory( - char *memory_buffer, + char* memory_buffer, size_t memory_buffer_size) { linked_ptr cur_func; int line_number = 0; int num_errors = 0; - char *save_ptr; + char* save_ptr; // If the length is 0, we can still pretend we have a symbol file. This is // for scenarios that want to test symbol lookup, but don't necessarily care @@ -160,7 +160,7 @@ bool BasicSourceLineResolver::Module::LoadMapFromMemory( &num_errors); } - char *buffer; + char* buffer; buffer = strtok_r(memory_buffer, "\r\n", &save_ptr); while (buffer != NULL) { @@ -207,7 +207,7 @@ bool BasicSourceLineResolver::Module::LoadMapFromMemory( LogParseError("Found source line data without a function", line_number, &num_errors); } else { - Line *line = ParseLine(buffer); + Line* line = ParseLine(buffer); if (!line) { LogParseError("ParseLine failed", line_number, &num_errors); } else { @@ -225,7 +225,7 @@ bool BasicSourceLineResolver::Module::LoadMapFromMemory( return true; } -void BasicSourceLineResolver::Module::LookupAddress(StackFrame *frame) const { +void BasicSourceLineResolver::Module::LookupAddress(StackFrame* frame) const { MemAddr address = frame->instruction - frame->module->base_address(); // First, look for a FUNC record that covers address. Use @@ -264,8 +264,8 @@ void BasicSourceLineResolver::Module::LookupAddress(StackFrame *frame) const { } } -WindowsFrameInfo *BasicSourceLineResolver::Module::FindWindowsFrameInfo( - const StackFrame *frame) const { +WindowsFrameInfo* BasicSourceLineResolver::Module::FindWindowsFrameInfo( + const StackFrame* frame) const { MemAddr address = frame->instruction - frame->module->base_address(); scoped_ptr result(new WindowsFrameInfo()); @@ -313,8 +313,8 @@ WindowsFrameInfo *BasicSourceLineResolver::Module::FindWindowsFrameInfo( return NULL; } -CFIFrameInfo *BasicSourceLineResolver::Module::FindCFIFrameInfo( - const StackFrame *frame) const { +CFIFrameInfo* BasicSourceLineResolver::Module::FindCFIFrameInfo( + const StackFrame* frame) const { MemAddr address = frame->instruction - frame->module->base_address(); MemAddr initial_base, initial_size; string initial_rules; @@ -347,9 +347,9 @@ CFIFrameInfo *BasicSourceLineResolver::Module::FindCFIFrameInfo( return rules.release(); } -bool BasicSourceLineResolver::Module::ParseFile(char *file_line) { +bool BasicSourceLineResolver::Module::ParseFile(char* file_line) { long index; - char *filename; + char* filename; if (SymbolParseHelper::ParseFile(file_line, &index, &filename)) { files_.insert(make_pair(index, string(filename))); return true; @@ -358,12 +358,12 @@ bool BasicSourceLineResolver::Module::ParseFile(char *file_line) { } BasicSourceLineResolver::Function* -BasicSourceLineResolver::Module::ParseFunction(char *function_line) { +BasicSourceLineResolver::Module::ParseFunction(char* function_line) { bool is_multiple; uint64_t address; uint64_t size; long stack_param_size; - char *name; + char* name; if (SymbolParseHelper::ParseFunction(function_line, &is_multiple, &address, &size, &stack_param_size, &name)) { return new Function(name, address, size, stack_param_size, is_multiple); @@ -372,7 +372,7 @@ BasicSourceLineResolver::Module::ParseFunction(char *function_line) { } BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine( - char *line_line) { + char* line_line) { uint64_t address; uint64_t size; long line_number; @@ -385,11 +385,11 @@ BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine( return NULL; } -bool BasicSourceLineResolver::Module::ParsePublicSymbol(char *public_line) { +bool BasicSourceLineResolver::Module::ParsePublicSymbol(char* public_line) { bool is_multiple; uint64_t address; long stack_param_size; - char *name; + char* name; if (SymbolParseHelper::ParsePublicSymbol(public_line, &is_multiple, &address, &stack_param_size, &name)) { @@ -411,7 +411,7 @@ bool BasicSourceLineResolver::Module::ParsePublicSymbol(char *public_line) { return false; } -bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) { +bool BasicSourceLineResolver::Module::ParseStackInfo(char* stack_info_line) { // Skip "STACK " prefix. stack_info_line += 6; @@ -419,7 +419,7 @@ bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) { // information this is. while (*stack_info_line == ' ') stack_info_line++; - const char *platform = stack_info_line; + const char* platform = stack_info_line; while (!strchr(kWhitespace, *stack_info_line)) stack_info_line++; *stack_info_line++ = '\0'; @@ -468,23 +468,23 @@ bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) { } bool BasicSourceLineResolver::Module::ParseCFIFrameInfo( - char *stack_info_line) { - char *cursor; + char* stack_info_line) { + char* cursor; // Is this an INIT record or a delta record? - char *init_or_address = strtok_r(stack_info_line, " \r\n", &cursor); + char* init_or_address = strtok_r(stack_info_line, " \r\n", &cursor); if (!init_or_address) return false; if (strcmp(init_or_address, "INIT") == 0) { // This record has the form "STACK INIT
". - char *address_field = strtok_r(NULL, " \r\n", &cursor); + char* address_field = strtok_r(NULL, " \r\n", &cursor); if (!address_field) return false; - char *size_field = strtok_r(NULL, " \r\n", &cursor); + char* size_field = strtok_r(NULL, " \r\n", &cursor); if (!size_field) return false; - char *initial_rules = strtok_r(NULL, "\r\n", &cursor); + char* initial_rules = strtok_r(NULL, "\r\n", &cursor); if (!initial_rules) return false; MemAddr address = strtoul(address_field, NULL, 16); @@ -494,8 +494,8 @@ bool BasicSourceLineResolver::Module::ParseCFIFrameInfo( } // This record has the form "STACK
". - char *address_field = init_or_address; - char *delta_rules = strtok_r(NULL, "\r\n", &cursor); + char* address_field = init_or_address; + char* delta_rules = strtok_r(NULL, "\r\n", &cursor); if (!delta_rules) return false; MemAddr address = strtoul(address_field, NULL, 16); cfi_delta_rules_[address] = delta_rules; @@ -503,8 +503,8 @@ bool BasicSourceLineResolver::Module::ParseCFIFrameInfo( } // static -bool SymbolParseHelper::ParseFile(char *file_line, long *index, - char **filename) { +bool SymbolParseHelper::ParseFile(char* file_line, long* index, + char** filename) { // FILE assert(strncmp(file_line, "FILE ", 5) == 0); file_line += 5; // skip prefix @@ -514,7 +514,7 @@ bool SymbolParseHelper::ParseFile(char *file_line, long *index, return false; } - char *after_number; + char* after_number; *index = strtol(tokens[0], &after_number, 10); if (!IsValidAfterNumber(after_number) || *index < 0 || *index == std::numeric_limits::max()) { @@ -530,9 +530,9 @@ bool SymbolParseHelper::ParseFile(char *file_line, long *index, } // static -bool SymbolParseHelper::ParseFunction(char *function_line, bool *is_multiple, - uint64_t *address, uint64_t *size, - long *stack_param_size, char **name) { +bool SymbolParseHelper::ParseFunction(char* function_line, bool* is_multiple, + uint64_t* address, uint64_t* size, + long* stack_param_size, char** name) { // FUNC []
assert(strncmp(function_line, "FUNC ", 5) == 0); function_line += 5; // skip prefix @@ -545,7 +545,7 @@ bool SymbolParseHelper::ParseFunction(char *function_line, bool *is_multiple, *is_multiple = strcmp(tokens[0], "m") == 0; int next_token = *is_multiple ? 1 : 0; - char *after_number; + char* after_number; *address = strtoull(tokens[next_token++], &after_number, 16); if (!IsValidAfterNumber(after_number) || *address == std::numeric_limits::max()) { @@ -568,16 +568,16 @@ bool SymbolParseHelper::ParseFunction(char *function_line, bool *is_multiple, } // static -bool SymbolParseHelper::ParseLine(char *line_line, uint64_t *address, - uint64_t *size, long *line_number, - long *source_file) { +bool SymbolParseHelper::ParseLine(char* line_line, uint64_t* address, + uint64_t* size, long* line_number, + long* source_file) { //
vector tokens; if (!Tokenize(line_line, kWhitespace, 4, &tokens)) { return false; } - char *after_number; + char* after_number; *address = strtoull(tokens[0], &after_number, 16); if (!IsValidAfterNumber(after_number) || *address == std::numeric_limits::max()) { @@ -613,10 +613,10 @@ bool SymbolParseHelper::ParseLine(char *line_line, uint64_t *address, } // static -bool SymbolParseHelper::ParsePublicSymbol(char *public_line, bool *is_multiple, - uint64_t *address, - long *stack_param_size, - char **name) { +bool SymbolParseHelper::ParsePublicSymbol(char* public_line, bool* is_multiple, + uint64_t* address, + long* stack_param_size, + char** name) { // PUBLIC []
assert(strncmp(public_line, "PUBLIC ", 7) == 0); public_line += 7; // skip prefix @@ -629,7 +629,7 @@ bool SymbolParseHelper::ParsePublicSymbol(char *public_line, bool *is_multiple, *is_multiple = strcmp(tokens[0], "m") == 0; int next_token = *is_multiple ? 1 : 0; - char *after_number; + char* after_number; *address = strtoull(tokens[next_token++], &after_number, 16); if (!IsValidAfterNumber(after_number) || *address == std::numeric_limits::max()) { @@ -647,7 +647,7 @@ bool SymbolParseHelper::ParsePublicSymbol(char *public_line, bool *is_multiple, } // static -bool SymbolParseHelper::IsValidAfterNumber(char *after_number) { +bool SymbolParseHelper::IsValidAfterNumber(char* after_number) { if (after_number != NULL && strchr(kWhitespace, *after_number) != NULL) { return true; } -- cgit v1.2.1