summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/qf.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/bin/qf.c b/bin/qf.c
index 98c897ce..0a79307e 100644
--- a/bin/qf.c
+++ b/bin/qf.c
@@ -54,37 +54,31 @@ static void push(struct Line line) {
 }
 
 static void parse(struct Line line) {
-	char *text = line.text;
-	size_t sep = strcspn(text, ":");
-	if (!text[sep]) {
+	line.path = strsep(&line.text, ":");
+	if (!line.text) {
 		line.type = Text;
+		line.text = line.path;
 		if (lines.len) line.path = lines.ptr[lines.len-1].path;
 		push(line);
 		return;
 	}
-	line.path = text;
-	text[sep] = '\0';
-	line.text = &text[sep+1];
-	if (
-		!lines.len ||
-		!lines.ptr[lines.len-1].path ||
-		strcmp(line.path, lines.ptr[lines.len-1].path)
-	) {
-		if (lines.len) {
-			push((struct Line) { .type = Text, .text = " " });
-		}
+	struct Line prev = {0};
+	if (lines.len) prev = lines.ptr[lines.len-1];
+	if (!prev.path || strcmp(line.path, prev.path)) {
+		if (lines.len) push((struct Line) { .type = Text, .text = " " });
 		line.type = File;
 		push(line);
 	}
 	char *rest;
 	line.nr = strtoul(line.text, &rest, 10);
-	line.type = Match;
-	if (rest != line.text && rest[0] == ':') {
+	if (rest > line.text && rest[0] == ':') {
 		line.type = Match;
 		line.text = &rest[1];
-	} else if (rest != line.text && rest[0] == '-') {
+	} else if (rest > line.text && rest[0] == '-') {
 		line.type = Context;
 		line.text = &rest[1];
+	} else {
+		line.type = Text;
 	}
 	push(line);
 }
ink/commit/ui-patch.c?h=1.3.0&id=aa12084f9835783abbd1f1e4609f8de05e73cec4&follow=1'>ui-patch: make sure to send http headersChristian Hesse 2015-08-13Makefile: make "git/config.mak.uname" inclusion optionalJohn Keeping 2015-08-13ui-shared: show full date in tooltip if longer ago than max_relativeJohn Keeping 2015-08-13ui-shared: use common function in print_rel_date()John Keeping 2015-08-13ui-shared: extract date formatting to a functionJohn Keeping 2015-08-13filter: don't use dlsym unnecessarilyJohn Keeping 2015-08-13ui-tree: use "sane" isgraph()John Keeping 2015-08-13cgit.h: move stdbool.h from ui-shared.hJohn Keeping 2015-08-13cache.c: fix header orderJohn Keeping 2015-08-13configfile.c: don't include system headers directlyJohn Keeping 2015-08-13Remove redundant includesJohn Keeping 2015-08-13Makefile: include Git's config.mak.unameJohn Keeping 2015-08-13tests: allow shell to be overriddenJohn Keeping 2015-08-13redirect: cleanlinessJason A. Donenfeld 2015-08-13redirect: be more careful for different cgi setupsJason A. Donenfeld 2015-08-12ui-log: fix double countingJohn Keeping 2015-08-12log: allow users to follow a fileJohn Keeping 2015-08-12shared: make cgit_diff_tree_cb publicJohn Keeping 2015-08-12t0110: Chain together using &&Jason A. Donenfeld 2015-08-12about: always ensure page has a trailing slashJason A. Donenfeld 2015-08-12filters: apply HTML escapingLazaros Koromilas 2015-08-12git: update to v2.5.0Christian Hesse 2015-08-12Fix processing of repo.hide and repo.ignoreDaniel Reichelt