mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-03 01:34:25 +03:00
Styleguide formatting.
This commit is contained in:
parent
a3394aa77f
commit
1f6744f26b
@ -143,8 +143,8 @@ static void free_matches(struct search_context *context)
|
||||
a = context->found->next;
|
||||
|
||||
/* empty the list before clearing and deleting the
|
||||
selections because the the clearing updates the
|
||||
screen immediately, causing nested accesses to the list */
|
||||
* selections because the the clearing updates the
|
||||
* screen immediately, causing nested accesses to the list */
|
||||
|
||||
context->found->prev = NULL;
|
||||
context->found->next = NULL;
|
||||
@ -235,11 +235,11 @@ static const char *find_pattern(const char *string, int s_len,
|
||||
}
|
||||
|
||||
matches = true;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
matches = false;
|
||||
}
|
||||
else if (s < es) {
|
||||
|
||||
} else if (s < es) {
|
||||
char ch = *p;
|
||||
if (ch == '#')
|
||||
matches = true;
|
||||
@ -253,16 +253,17 @@ static const char *find_pattern(const char *string, int s_len,
|
||||
ss = s; /* remember first non-'*' char */
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
matches = false;
|
||||
}
|
||||
|
||||
if (matches) {
|
||||
p++; s++;
|
||||
}
|
||||
else {
|
||||
/* doesn't match, resume with stacked context if we have one */
|
||||
if (--top < 0) return NULL; /* no match, give up */
|
||||
} else {
|
||||
/* doesn't match,
|
||||
* resume with stacked context if we have one */
|
||||
if (--top < 0)
|
||||
return NULL; /* no match, give up */
|
||||
|
||||
ss = context[top].ss;
|
||||
s = context[top].s;
|
||||
@ -303,10 +304,12 @@ static struct list_entry *add_entry(unsigned start_idx, unsigned end_idx,
|
||||
|
||||
entry->next = 0;
|
||||
entry->prev = context->found->prev;
|
||||
|
||||
if (context->found->prev == NULL)
|
||||
context->found->next = entry;
|
||||
else
|
||||
context->found->prev->next = entry;
|
||||
|
||||
context->found->prev = entry;
|
||||
|
||||
return entry;
|
||||
@ -341,7 +344,8 @@ static bool find_occurrences_html(const char *pattern, int p_len,
|
||||
const char *pos = find_pattern(text, length,
|
||||
pattern, p_len, case_sens,
|
||||
&match_length);
|
||||
if (!pos) break;
|
||||
if (!pos)
|
||||
break;
|
||||
|
||||
/* found string in box => add to list */
|
||||
match_offset = pos - cur->text;
|
||||
@ -403,7 +407,8 @@ static bool find_occurrences_text(const char *pattern, int p_len,
|
||||
const char *pos = find_pattern(text, length,
|
||||
pattern, p_len, case_sens,
|
||||
&match_length);
|
||||
if (!pos) break;
|
||||
if (!pos)
|
||||
break;
|
||||
|
||||
/* found string in line => add to list */
|
||||
start_idx = offset + (pos - text);
|
||||
@ -455,9 +460,6 @@ static void search_text(const char *string, int string_len,
|
||||
return;
|
||||
}
|
||||
|
||||
/* LOG(("do_search '%s' - '%s' (%p, %p) %p (%d, %d) %d",
|
||||
search_data.string, string, search_data.content, c, search_data.found->next,
|
||||
search_data.prev_case_sens, case_sens, forwards)); */
|
||||
|
||||
/* check if we need to start a new search or continue an old one */
|
||||
if (context->newsearch) {
|
||||
@ -465,6 +467,7 @@ static void search_text(const char *string, int string_len,
|
||||
|
||||
if (context->string != NULL)
|
||||
free(context->string);
|
||||
|
||||
context->current = NULL;
|
||||
free_matches(context);
|
||||
|
||||
@ -502,19 +505,17 @@ static void search_text(const char *string, int string_len,
|
||||
context->callbacks.gui_p);
|
||||
|
||||
context->prev_case_sens = case_sensitive;
|
||||
/* LOG(("%d %p %p (%p, %p)", new, search_data.found->next, search_data.current,
|
||||
search_data.current->prev, search_data.current->next)); */
|
||||
|
||||
/* new search, beginning at the top of the page */
|
||||
context->current = context->found->next;
|
||||
context->newsearch = false;
|
||||
}
|
||||
else if (context->current != NULL) {
|
||||
|
||||
} else if (context->current != NULL) {
|
||||
/* continued search in the direction specified */
|
||||
if (forwards) {
|
||||
if (context->current->next)
|
||||
context->current = context->current->next;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (context->current->prev)
|
||||
context->current = context->current->prev;
|
||||
}
|
||||
@ -525,6 +526,7 @@ static void search_text(const char *string, int string_len,
|
||||
if (context->callbacks.gui->status != NULL)
|
||||
context->callbacks.gui->status((context->current != NULL),
|
||||
context->callbacks.gui_p);
|
||||
|
||||
search_show_all(showall, context);
|
||||
|
||||
if (context->callbacks.gui->back_state != NULL)
|
||||
@ -581,7 +583,8 @@ void search_step(struct search_context *context, search_flags_t flags,
|
||||
|
||||
string_len = strlen(string);
|
||||
for (i = 0; i < string_len; i++)
|
||||
if (string[i] != '#' && string[i] != '*') break;
|
||||
if (string[i] != '#' && string[i] != '*')
|
||||
break;
|
||||
if (i >= string_len) {
|
||||
union content_msg_data msg_data;
|
||||
free_matches(context);
|
||||
@ -675,11 +678,12 @@ void search_destroy_context(struct search_context *context)
|
||||
|
||||
if (context->c != NULL) {
|
||||
|
||||
if (context->is_html)
|
||||
if (context->is_html) {
|
||||
html_set_search(context->c, NULL);
|
||||
else
|
||||
} else {
|
||||
textplain_set_search(context->c, NULL);
|
||||
}
|
||||
}
|
||||
if ((context->string != NULL) && (context->callbacks.gui != NULL) &&
|
||||
(context->callbacks.gui->add_recent != NULL)) {
|
||||
context->callbacks.gui->add_recent(context->string,
|
||||
|
Loading…
Reference in New Issue
Block a user