[geany/geany-plugins] 775632: debugger/gdb_mi: Improve implementation of parse_cstring()
Colomban Wendling
git-noreply at xxxxx
Sun Feb 7 03:35:36 UTC 2016
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Sun, 07 Feb 2016 03:35:36 UTC
Commit: 77563203d6eb0cea464a4b1745e368360e6d89fb
https://github.com/geany/geany-plugins/commit/77563203d6eb0cea464a4b1745e368360e6d89fb
Log Message:
-----------
debugger/gdb_mi: Improve implementation of parse_cstring()
Copy blocks as long as possible at once instead of byte by byte, e.g.
everything between two escape sequences at once.
This gives a speedup of about 8% on typical data with few escape
sequences.
Modified Paths:
--------------
debugger/src/gdb_mi.c
Modified: debugger/src/gdb_mi.c
10 lines changed, 8 insertions(+), 2 deletions(-)
===================================================================
@@ -98,13 +98,17 @@ static gchar *parse_cstring(const gchar **p)
if (**p == '"')
{
+ const gchar *base;
+
(*p)++;
+ base = *p;
while (**p != '"')
{
gchar c = **p;
/* TODO: check expansions here */
if (c == '\\')
{
+ g_string_append_len(str, base, (*p) - base);
(*p)++;
c = **p;
switch (g_ascii_tolower(c))
@@ -159,12 +163,14 @@ static gchar *parse_cstring(const gchar **p)
}
break;
}
+ g_string_append_c(str, c);
+ base = (*p) + 1;
}
- if (**p == '\0')
+ else if (**p == '\0')
break;
- g_string_append_c(str, c);
(*p)++;
}
+ g_string_append_len(str, base, (*p) - base);
if (**p == '"')
(*p)++;
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list