Thread (32 messages) flat view 32 messages, 3 authors, 2016-06-15

Re: [PATCH v4 06/12] ref-filter: introduce color_atom_parser()

From: Eric Sunshine <hidden>
Date: 2016-06-15 23:08:06

On Sun, Jan 31, 2016 at 12:42 PM, Karthik Nayak [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Introduce color_atom_parser() which will parse a "color" atom and
store its color in the "used_atom" structure for further usage in
populate_value().

Signed-off-by: Karthik Nayak <redacted>
---
diff --git a/ref-filter.c b/ref-filter.c
@@ -29,10 +29,21 @@ typedef enum { FIELD_STR, FIELD_ULONG, FIELD_TIME } cmp_type;
 static struct used_atom {
        const char *name;
        cmp_type type;
+       union {
+               char color[COLOR_MAXLEN];
+       } u;
 } *used_atom;
 static int used_atom_cnt, need_tagged, need_symref;
 static int need_color_reset_at_eol;

+static void color_atom_parser(struct used_atom *atom, const char *color_value)
+{
+       if (!color_value)
+               die(_("expected format: %%(color:<color>)"));
+       if (color_parse(color_value, atom->u.color) < 0)
+               die(_("invalid color value: %s"), atom->u.color);
Shouldn't this be:

    die(_("invalid color value: %s"), color_value);

?
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help