Skip to content

Commit f80bee2

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Ben Toews <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1b0eeec commit f80bee2

File tree

2 files changed

+38
-28
lines changed

2 files changed

+38
-28
lines changed

gpg-interface.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,6 @@ void print_signature_buffer(const struct signature_check *sigc, unsigned flags)
101101
fputs(output, stderr);
102102
}
103103

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-
*/
110104
size_t parse_signature(const char *buf, unsigned long size)
111105
{
112106
char *eol;
@@ -151,12 +145,6 @@ const char *get_signing_key(void)
151145
return git_committer_info(IDENT_STRICT|IDENT_NO_DATE);
152146
}
153147

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-
*/
160148
int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *signing_key)
161149
{
162150
struct child_process gpg = CHILD_PROCESS_INIT;
@@ -198,11 +186,6 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
198186
return 0;
199187
}
200188

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-
*/
206189
int verify_signed_buffer(const char *payload, size_t payload_size,
207190
const char *signature, size_t signature_size,
208191
struct strbuf *gpg_output, struct strbuf *gpg_status)

gpg-interface.h

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,43 @@ struct signature_check {
2323
char *key;
2424
};
2525

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);
3764

3865
#endif

0 commit comments

Comments
 (0)