gpg-interface: modernize function declarations

Let's drop "extern" from our declarations, which brings us in line with our modern style guidelines. While we're here, let's wrap some of the overly long lines, and move docstrings for public functions to their declarations, since they document the interface. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Ben Toews <mastahyeti@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Apr 13, 2018 at 15:18 UTC f80bee27e3c3fc9085427945f97a2f7756500ea9
2 files changed +38 -28
gpg-interface.c
-17
@@ -101,12 +101,6 @@ void print_signature_buffer(const struct signature_check *sigc, unsigned flags)
101 fputs(output, stderr);
102 }
103
104 -/*
105 - * Look at GPG signed content (e.g. a signed tag object), whose
106 - * payload is followed by a detached signature on it. Return the
107 - * offset where the embedded detached signature begins, or the end of
108 - * the data when there is no such signature.
109 - */
104 size_t parse_signature(const char *buf, unsigned long size)
105 {
106 char *eol;
@@ -151,12 +145,6 @@ const char *get_signing_key(void)
145 return git_committer_info(IDENT_STRICT|IDENT_NO_DATE);
146 }
147
154 -/*
155 - * Create a detached signature for the contents of "buffer" and append
156 - * it after "signature"; "buffer" and "signature" can be the same
157 - * strbuf instance, which would cause the detached signature appended
158 - * at the end.
159 - */
148 int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *signing_key)
149 {
150 struct child_process gpg = CHILD_PROCESS_INIT;
@@ -198,11 +186,6 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
186 return 0;
187 }
188
201 -/*
202 - * Run "gpg" to see if the payload matches the detached signature.
203 - * gpg_output, when set, receives the diagnostic output from GPG.
204 - * gpg_status, when set, receives the status output from GPG.
205 - */
189 int verify_signed_buffer(const char *payload, size_t payload_size,
190 const char *signature, size_t signature_size,
191 struct strbuf *gpg_output, struct strbuf *gpg_status)
gpg-interface.h
+38 -11
@@ -23,16 +23,43 @@ struct signature_check {
23 char *key;
24 };
25
26 -extern void signature_check_clear(struct signature_check *sigc);
27 -extern size_t parse_signature(const char *buf, unsigned long size);
28 -extern void parse_gpg_output(struct signature_check *);
29 -extern int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *signing_key);
30 -extern int verify_signed_buffer(const char *payload, size_t payload_size, const char *signature, size_t signature_size, struct strbuf *gpg_output, struct strbuf *gpg_status);
31 -extern int git_gpg_config(const char *, const char *, void *);
32 -extern void set_signing_key(const char *);
33 -extern const char *get_signing_key(void);
34 -extern int check_signature(const char *payload, size_t plen,
35 - const char *signature, size_t slen, struct signature_check *sigc);
36 -void print_signature_buffer(const struct signature_check *sigc, unsigned flags);
26 +void signature_check_clear(struct signature_check *sigc);
27 +
28 +/*
29 + * Look at GPG signed content (e.g. a signed tag object), whose
30 + * payload is followed by a detached signature on it. Return the
31 + * offset where the embedded detached signature begins, or the end of
32 + * the data when there is no such signature.
33 + */
34 +size_t parse_signature(const char *buf, unsigned long size);
35 +
36 +void parse_gpg_output(struct signature_check *);
37 +
38 +/*
39 + * Create a detached signature for the contents of "buffer" and append
40 + * it after "signature"; "buffer" and "signature" can be the same
41 + * strbuf instance, which would cause the detached signature appended
42 + * at the end.
43 + */
44 +int sign_buffer(struct strbuf *buffer, struct strbuf *signature,
45 + const char *signing_key);
46 +
47 +/*
48 + * Run "gpg" to see if the payload matches the detached signature.
49 + * gpg_output, when set, receives the diagnostic output from GPG.
50 + * gpg_status, when set, receives the status output from GPG.
51 + */
52 +int verify_signed_buffer(const char *payload, size_t payload_size,
53 + const char *signature, size_t signature_size,
54 + struct strbuf *gpg_output, struct strbuf *gpg_status);
55 +
56 +int git_gpg_config(const char *, const char *, void *);
57 +void set_signing_key(const char *);
58 +const char *get_signing_key(void);
59 +int check_signature(const char *payload, size_t plen,
60 + const char *signature, size_t slen,
61 + struct signature_check *sigc);
62 +void print_signature_buffer(const struct signature_check *sigc,
63 + unsigned flags);
64
65 #endif