git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Git Mailing List <git@vger.kernel.org>
Cc: "Jeff King" <peff@peff.net>, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 3/4] parse-options: const parse_options_concat() parameters
Date: Sun, 9 Feb 2020 16:57:56 +0100	[thread overview]
Message-ID: <2f8eeca8-bada-d67d-9c96-bf10f97a794e@web.de> (raw)
In-Reply-To: <11b82734-f61c-5e73-2d0c-22208c06d495@web.de>

Document the fact that the function doesn't modify the two option arrays
passed to it by adding the keyword const to each parameter.

Signed-off-by: René Scharfe <l.s.r@web.de>
---
 parse-options-cb.c | 3 ++-
 parse-options.h    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/parse-options-cb.c b/parse-options-cb.c
index db6f666ef7..7d56681130 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -181,7 +181,8 @@ struct option *parse_options_dup(const struct option *o)
 	return opts;
 }

-struct option *parse_options_concat(struct option *a, struct option *b)
+struct option *parse_options_concat(const struct option *a,
+				    const struct option *b)
 {
 	struct option *ret;
 	size_t a_len = parse_options_count(a);
diff --git a/parse-options.h b/parse-options.h
index fdc0c1cb97..1d60205881 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -281,7 +281,7 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
 int parse_options_end(struct parse_opt_ctx_t *ctx);

 struct option *parse_options_dup(const struct option *a);
-struct option *parse_options_concat(struct option *a, struct option *b);
+struct option *parse_options_concat(const struct option *a, const struct option *b);

 /*----- some often used options -----*/
 int parse_opt_abbrev_cb(const struct option *, const char *, int);
--
2.25.0

  parent reply	other threads:[~2020-02-09 15:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-09 15:53 [PATCH 0/4] parse-options: simplify parse_options_concat() and parse_options_dup() René Scharfe
2020-02-09 15:55 ` [PATCH 1/4] parse-options: use COPY_ARRAY in parse_options_concat() René Scharfe
2020-02-09 15:56 ` [PATCH 2/4] parse-options: factor out parse_options_count() René Scharfe
2020-02-09 17:56   ` Eric Sunshine
2020-02-09 18:36     ` René Scharfe
2020-02-09 15:57 ` René Scharfe [this message]
2020-02-09 15:58 ` [PATCH 4/4] parse-options: simplify parse_options_dup() René Scharfe
2020-02-10 17:49   ` Junio C Hamano
2020-02-10 22:25 ` [PATCH 0/4] parse-options: simplify parse_options_concat() and parse_options_dup() Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f8eeca8-bada-d67d-9c96-bf10f97a794e@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).