Ignore spaces and tabs for blank line detection.
Bug: 133158847
Change-Id: I20f55fd13a7983da5a2043a1dd29c79d15756333
diff --git a/src/trace_processor/trace_processor_shell.cc b/src/trace_processor/trace_processor_shell.cc
index d6e7697..2eefdc6 100644
--- a/src/trace_processor/trace_processor_shell.cc
+++ b/src/trace_processor/trace_processor_shell.cc
@@ -400,12 +400,21 @@
}
}
+bool IsBlankLine(char* buffer) {
+ size_t buf_size = strlen(buffer);
+ for (size_t i = 0; i < buf_size; ++i) {
+ if (buffer[i] != ' ' && buffer[i] != '\t' && buffer[i] != '\n')
+ return false;
+ }
+ return true;
+}
+
bool LoadQueries(FILE* input, std::vector<std::string>* output) {
char buffer[4096];
while (!feof(input) && !ferror(input)) {
std::string sql_query;
while (fgets(buffer, sizeof(buffer), input)) {
- if (strncmp(buffer, "\n", sizeof(buffer)) == 0)
+ if (IsBlankLine(buffer))
break;
sql_query.append(buffer);
}