Re: [PATCH v2 2/3] trailers: export action enums and corresponding lookup functions
From: Junio C Hamano <hidden>
Date: 2017-07-17 21:16:12
Christian Couder [off-list ref] writes:
On Thu, Jul 13, 2017 at 12:21 AM, Paolo Bonzini [off-list ref] wrote:quoted
diff --git a/trailer.h b/trailer.h index e90ba1270..f306bf059 100644 --- a/trailer.h +++ b/trailer.h@@ -1,11 +1,33 @@ #ifndef TRAILER_H #define TRAILER_H +enum action_where { + WHERE_END, + WHERE_AFTER, + WHERE_BEFORE, + WHERE_START +}; +enum action_if_exists { + EXISTS_ADD_IF_DIFFERENT_NEIGHBOR, + EXISTS_ADD_IF_DIFFERENT, + EXISTS_ADD, + EXISTS_REPLACE, + EXISTS_DO_NOTHING +}; +enum action_if_missing { + MISSING_ADD, + MISSING_DO_NOTHING +};As these enums are now in trailer.h, maybe more specific names like "trailer_action_where" instead of "action_where" would be better.quoted
struct trailer_opts { int in_place; int trim_empty; }; +int set_where(enum action_where *item, const char *value); +int set_if_exists(enum action_if_exists *item, const char *value); +int set_if_missing(enum action_if_missing *item, const char *value);"trailer_" should perhaps be added at the beginning of the names of the above functions too.
All sensible suggestions. Thanks.