git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.

Previous: Paolo BonziniNext: Junio C Hamano
Message 4 of 8 in “interpret-trailers: add --where, --if-exists, --if-missing”
  1. 0/3 interpret-trailers: add --where, --if-exists, --if-missingPaolo Bonzini, Jul 12, 2017
  2. 1/3 trailers: create struct trailer_optsPaolo Bonzini, Jul 12, 2017
  3. 2/3 trailers: export action enums and corresponding lookup functionsPaolo Bonzini, Jul 12, 2017
  4. Christian CouderJul 13, 2017
  5. Junio C HamanoJul 17, 2017
  6. 3/3 interpret-trailers: add options for actionsPaolo Bonzini, Jul 12, 2017
  7. Junio C HamanoJul 12, 2017
  8. Paolo BonziniJul 12, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.