Re: [PATCH v2 2/3] trailers: export action enums and corresponding lookup functions
From: Christian Couder <hidden>
Date: 2017-07-13 06:00:28
On Thu, Jul 13, 2017 at 12:21 AM, Paolo Bonzini [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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.
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.