From a6bfec76c85bbe9187b536ff78252b82e30e20d3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 13 May 2019 23:39:02 +0200 Subject: [PATCH 1/2] pkt-line: fix declaration of `set_packet_header()` When this function was changed in a97d00799a19 (remote-curl: use post_rpc() for protocol v2 also, 2019-02-21) from file-local to global, the declaration was incorrectly missing the `const` qualifier. Let's fix that. Signed-off-by: Johannes Schindelin --- pkt-line.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkt-line.h b/pkt-line.h index 5c62015db4df70..04ae7d802c123c 100644 --- a/pkt-line.h +++ b/pkt-line.h @@ -25,7 +25,7 @@ void packet_delim(int fd); void packet_write_fmt(int fd, const char *fmt, ...) __attribute__((format (printf, 2, 3))); void packet_buf_flush(struct strbuf *buf); void packet_buf_delim(struct strbuf *buf); -void set_packet_header(char *buf, int size); +void set_packet_header(char *buf, const int size); void packet_write(int fd_out, const char *buf, size_t size); void packet_buf_write(struct strbuf *buf, const char *fmt, ...) __attribute__((format (printf, 2, 3))); void packet_buf_write_len(struct strbuf *buf, const char *data, size_t len); From dd283736b72d3e52bd298b0360ab66ffd15c1cf9 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 13 May 2019 23:53:15 +0200 Subject: [PATCH 2/2] parse-options: adjust `parse_opt_unknown_cb()`s declared return type In f41179f16ba2 (parse-options: avoid magic return codes, 2019-01-27), the signature of the low-level parse-opt callback function was changed to return an `enum`. And while the implementations were changed, one declaration was left unchanged, still claiming to return `int`. This can potentially lead to problems, as compilers are free to choose any integral type for an `enum` as long as it can represent all declared values. Signed-off-by: Johannes Schindelin --- parse-options.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/parse-options.h b/parse-options.h index bd00cf004900c4..cd756833a9947f 100644 --- a/parse-options.h +++ b/parse-options.h @@ -286,7 +286,9 @@ int parse_opt_commit(const struct option *, const char *, int); int parse_opt_tertiary(const struct option *, const char *, int); int parse_opt_string_list(const struct option *, const char *, int); int parse_opt_noop_cb(const struct option *, const char *, int); -int parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx, const struct option *, const char *, int); +enum parse_opt_result parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx, + const struct option *, + const char *, int); int parse_opt_passthru(const struct option *, const char *, int); int parse_opt_passthru_argv(const struct option *, const char *, int);