Re: [PATCH v2 2/3] trailers: export action enums and corresponding lookup functions
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Jul 13, 2017, 06:00 UTC
- Message-ID
- <CAP8UFD0LEHDutF83=V9zrDnFKy27dJSrq5DHV-8YV1=y=cPXqg@mail.gmail.com>
- In-Reply-To
- <20170712222116.7095-3-bonzini@gnu.org>
On Thu, Jul 13, 2017 at 12:21 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
Show 25 quoted lines
> 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.
Show 8 quoted lines
> 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.