rename tog_line_color to just tog_color
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
diff --git a/tog/tog.c b/tog/tog.c
index c01e870..b99cf6c 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -112,12 +112,12 @@ struct commit_queue {
struct commit_queue_head head;
};
-struct tog_line_color {
- SIMPLEQ_ENTRY(tog_line_color) entry;
+struct tog_color {
+ SIMPLEQ_ENTRY(tog_color) entry;
regex_t regex;
short colorpair;
};
-SIMPLEQ_HEAD(tog_line_colors, tog_line_color);
+SIMPLEQ_HEAD(tog_colors, tog_color);
struct tog_diff_view_state {
struct got_object_id *id1, *id2;
@@ -128,7 +128,7 @@ struct tog_diff_view_state {
int diff_context;
struct got_repository *repo;
struct got_reflist_head *refs;
- struct tog_line_colors line_colors;
+ struct tog_colors line_colors;
/* passed from log view; may be NULL */
struct tog_view *log_view;
@@ -242,7 +242,7 @@ struct tog_tree_view_state {
struct got_repository *repo;
struct got_reflist_head *refs;
struct got_tree_entry *matched_entry;
- struct tog_line_colors line_colors;
+ struct tog_colors line_colors;
};
/*
@@ -2458,10 +2458,10 @@ match_line(const char *line, regex_t *regex)
return regexec(regex, line, 1, ®match, 0) == 0;
}
-struct tog_line_color *
-match_line_color(struct tog_line_colors *colors, const char *line)
+struct tog_color *
+match_line_color(struct tog_colors *colors, const char *line)
{
- struct tog_line_color *tc = NULL;
+ struct tog_color *tc = NULL;
SIMPLEQ_FOREACH(tc, colors, entry) {
if (match_line(line, &tc->regex))
@@ -2474,12 +2474,12 @@ match_line_color(struct tog_line_colors *colors, const char *line)
static const struct got_error *
draw_file(struct tog_view *view, FILE *f, int *first_displayed_line,
int *last_displayed_line, int *eof, int max_lines, char *header,
- struct tog_line_colors *colors)
+ struct tog_colors *colors)
{
const struct got_error *err;
int nlines = 0, nprinted = 0;
char *line;
- struct tog_line_color *lc;
+ struct tog_color *tc;
size_t len;
wchar_t *wline;
int width;
@@ -2524,14 +2524,14 @@ draw_file(struct tog_view *view, FILE *f, int *first_displayed_line,
return err;
}
- lc = match_line_color(colors, line);
- if (lc)
+ tc = match_line_color(colors, line);
+ if (tc)
wattr_on(view->window,
- COLOR_PAIR(lc->colorpair), NULL);
+ COLOR_PAIR(tc->colorpair), NULL);
waddwstr(view->window, wline);
- if (lc)
+ if (tc)
wattr_off(view->window,
- COLOR_PAIR(lc->colorpair), NULL);
+ COLOR_PAIR(tc->colorpair), NULL);
if (width <= view->ncols - 1)
waddch(view->window, '\n');
if (++nprinted == 1)
@@ -2727,46 +2727,46 @@ diff_view_indicate_progress(struct tog_view *view)
}
static const struct got_error *
-add_line_color(struct tog_line_colors *colors, const char *pattern,
+add_line_color(struct tog_colors *colors, const char *pattern,
int idx, short color)
{
const struct got_error *err = NULL;
- struct tog_line_color *lc;
+ struct tog_color *tc;
int regerr = 0;
init_pair(idx, color, -1);
- lc = calloc(1, sizeof(*lc));
- if (lc == NULL)
+ tc = calloc(1, sizeof(*tc));
+ if (tc == NULL)
return got_error_from_errno("calloc");
- regerr = regcomp(&lc->regex, pattern,
+ regerr = regcomp(&tc->regex, pattern,
REG_EXTENDED | REG_NOSUB | REG_NEWLINE);
if (regerr) {
static char regerr_msg[512];
static char err_msg[512];
- regerror(regerr, &lc->regex, regerr_msg,
+ regerror(regerr, &tc->regex, regerr_msg,
sizeof(regerr_msg));
snprintf(err_msg, sizeof(err_msg), "regcomp: %s",
regerr_msg);
err = got_error_msg(GOT_ERR_REGEX, err_msg);
- free(lc);
+ free(tc);
return err;
}
- lc->colorpair = idx;
- SIMPLEQ_INSERT_HEAD(colors, lc, entry);
+ tc->colorpair = idx;
+ SIMPLEQ_INSERT_HEAD(colors, tc, entry);
return NULL;
}
static void
-free_line_colors(struct tog_line_colors *colors)
+free_line_colors(struct tog_colors *colors)
{
- struct tog_line_color *lc;
+ struct tog_color *tc;
while (!SIMPLEQ_EMPTY(colors)) {
- lc = SIMPLEQ_FIRST(colors);
+ tc = SIMPLEQ_FIRST(colors);
SIMPLEQ_REMOVE_HEAD(colors, entry);
- regfree(&lc->regex);
- free(lc);
+ regfree(&tc->regex);
+ free(tc);
}
}
@@ -4127,12 +4127,12 @@ draw_tree_entries(struct tog_view *view,
struct got_tree_entry **selected_entry, int *ndisplayed,
const char *label, int show_ids, const char *parent_path,
const struct got_tree_entries *entries, int selected, int limit,
- int isroot, struct tog_line_colors *colors)
+ int isroot, struct tog_colors *colors)
{
const struct got_error *err = NULL;
struct got_tree_entry *te;
wchar_t *wline;
- struct tog_line_color *lc;
+ struct tog_color *tc;
int width, n;
*ndisplayed = 0;
@@ -4224,14 +4224,14 @@ draw_tree_entries(struct tog_view *view,
wstandout(view->window);
*selected_entry = te;
}
- lc = match_line_color(colors, line);
- if (lc)
+ tc = match_line_color(colors, line);
+ if (tc)
wattr_on(view->window,
- COLOR_PAIR(lc->colorpair), NULL);
+ COLOR_PAIR(tc->colorpair), NULL);
waddwstr(view->window, wline);
- if (lc)
+ if (tc)
wattr_off(view->window,
- COLOR_PAIR(lc->colorpair), NULL);
+ COLOR_PAIR(tc->colorpair), NULL);
if (width < view->ncols - 1)
waddch(view->window, '\n');
if (n == selected && view->focussed)