aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui-shared.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/ui-shared.c b/ui-shared.c
index ea6d18b..2d695a7 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -364,27 +364,30 @@ void cgit_commit_link2(char *name, const char *title, const char *class,
{
if (checkForIssueLink) {
int last_match = 0;
+ int offset = 0;
for (;;) {
- const char* sub = strstr(name + last_match, "FS#");
+ const char* sub = strstr(name + last_match + offset, "FS#");
if (sub != NULL) {
- const char* sub = strstr(name + last_match, "FS#");
int found_pos = (sub - (name + last_match));
- if (found_pos > 0) {
- char* left_part = sub_str(name, last_match, last_match + found_pos);
- cgit_commit_link3(left_part, title, class, head, rev, path);
- free(left_part);
- }
sub += 3;
int numbercount = 0;
while (*sub >= '0' && *sub <= '9') {
numbercount++;
sub++;
}
+ if (!numbercount) {
+ offset = found_pos + 3;
+ continue;
+ } else {
+ offset = 0;
+ }
+ if (found_pos > 0) {
+ char* left_part = sub_str(name, last_match, last_match + found_pos);
+ cgit_commit_link3(left_part, title, class, head, rev, path);
+ free(left_part);
+ }
char* issue_part = sub_str(name, last_match + found_pos, last_match + found_pos + 3 + numbercount);
- if (numbercount)
cgit_issue_link(issue_part);
- else
- cgit_commit_link3(issue_part, title, class, head, rev, path);
free(issue_part);
last_match += found_pos + 3 + numbercount;
} else {
@@ -1166,26 +1169,30 @@ extern void cgit_author_link(const char *author, const char *head)
extern void cgit_check_text_for_issue_link(const char* text)
{
int last_match = 0;
+ int offset = 0;
for (;;) {
- const char* sub = strstr(text + last_match, "FS#");
+ const char* sub = strstr(text + last_match + offset, "FS#");
if(sub != NULL) {
int found_pos = (sub - (text + last_match));
- if (found_pos > 0) {
- char* left_part = sub_str(text, last_match, last_match + found_pos);
- html_txt(left_part);
- free(left_part);
- }
sub += 3;
int numbercount = 0;
while (*sub >= '0' && *sub <= '9') {
numbercount++;
sub++;
}
+ if (!numbercount) {
+ offset = found_pos + 3;
+ continue;
+ } else {
+ offset = 0;
+ }
+ if (found_pos > 0) {
+ char* left_part = sub_str(text, last_match, last_match + found_pos);
+ html_txt(left_part);
+ free(left_part);
+ }
char* issue_part = sub_str(text, last_match + found_pos, last_match + found_pos + 3 + numbercount);
- if (numbercount)
cgit_issue_link(issue_part);
- else
- html_txt(issue_part);
free(issue_part);
last_match += found_pos + 3 + numbercount;
} else {