Skip to content

Commit f4584a1

Browse files
authored
Merge pull request libgit2#5102 from libgit2/ethomson/callback_names
Callback type names should be suffixed with `_cb`
2 parents dd47a3e + 178df69 commit f4584a1

File tree

6 files changed

+43
-13
lines changed

6 files changed

+43
-13
lines changed

include/git2/deprecated.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "object.h"
1515
#include "refs.h"
1616
#include "remote.h"
17+
#include "trace.h"
1718

1819
/*
1920
* Users can avoid deprecated functions by defining `GIT_DEPRECATE_HARD`.
@@ -246,6 +247,35 @@ GIT_EXTERN(void) giterr_set_oom(void);
246247

247248
/**@}*/
248249

250+
/** @name Deprecated Credential Callback Types
251+
*
252+
* These types are retained for backward compatibility. The newer
253+
* versions of these values should be preferred in all new code.
254+
*
255+
* There is no plan to remove these backward compatibility values at
256+
* this time.
257+
*/
258+
/**@{*/
259+
260+
typedef git_cred_sign_cb git_cred_sign_callback;
261+
typedef git_cred_ssh_interactive_cb git_cred_ssh_interactive_callback;
262+
263+
/**@}*/
264+
265+
/** @name Deprecated Trace Callback Types
266+
*
267+
* These types are retained for backward compatibility. The newer
268+
* versions of these values should be preferred in all new code.
269+
*
270+
* There is no plan to remove these backward compatibility values at
271+
* this time.
272+
*/
273+
/**@{*/
274+
275+
typedef git_trace_cb git_trace_callback;
276+
277+
/**@}*/
278+
249279
/** @name Deprecated Transfer Progress Types
250280
*
251281
* These types are retained for backward compatibility. The newer

include/git2/trace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ typedef enum {
4949
/**
5050
* An instance for a tracing function
5151
*/
52-
typedef void GIT_CALLBACK(git_trace_callback)(git_trace_level_t level, const char *msg);
52+
typedef void GIT_CALLBACK(git_trace_cb)(git_trace_level_t level, const char *msg);
5353

5454
/**
5555
* Sets the system tracing configuration to the specified level with the
@@ -60,7 +60,7 @@ typedef void GIT_CALLBACK(git_trace_callback)(git_trace_level_t level, const cha
6060
* @param cb Function to call with trace data
6161
* @return 0 or an error code
6262
*/
63-
GIT_EXTERN(int) git_trace_set(git_trace_level_t level, git_trace_callback cb);
63+
GIT_EXTERN(int) git_trace_set(git_trace_level_t level, git_trace_cb cb);
6464

6565
/** @} */
6666
GIT_END_DECL

include/git2/transport.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ typedef struct _LIBSSH2_USERAUTH_KBDINT_PROMPT LIBSSH2_USERAUTH_KBDINT_PROMPT;
165165
typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE LIBSSH2_USERAUTH_KBDINT_RESPONSE;
166166
#endif
167167

168-
typedef int GIT_CALLBACK(git_cred_sign_callback)(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len, const unsigned char *data, size_t data_len, void **abstract);
169-
typedef void GIT_CALLBACK(git_cred_ssh_interactive_callback)(const char* name, int name_len, const char* instruction, int instruction_len, int num_prompts, const LIBSSH2_USERAUTH_KBDINT_PROMPT* prompts, LIBSSH2_USERAUTH_KBDINT_RESPONSE* responses, void **abstract);
168+
typedef int GIT_CALLBACK(git_cred_sign_cb)(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len, const unsigned char *data, size_t data_len, void **abstract);
169+
typedef void GIT_CALLBACK(git_cred_ssh_interactive_cb)(const char* name, int name_len, const char* instruction, int instruction_len, int num_prompts, const LIBSSH2_USERAUTH_KBDINT_PROMPT* prompts, LIBSSH2_USERAUTH_KBDINT_RESPONSE* responses, void **abstract);
170170

171171
/**
172172
* A ssh key from disk
@@ -185,7 +185,7 @@ typedef struct git_cred_ssh_key {
185185
typedef struct git_cred_ssh_interactive {
186186
git_cred parent;
187187
char *username;
188-
git_cred_ssh_interactive_callback prompt_callback;
188+
git_cred_ssh_interactive_cb prompt_callback;
189189
void *payload;
190190
} git_cred_ssh_interactive;
191191

@@ -197,7 +197,7 @@ typedef struct git_cred_ssh_custom {
197197
char *username;
198198
char *publickey;
199199
size_t publickey_len;
200-
git_cred_sign_callback sign_callback;
200+
git_cred_sign_cb sign_callback;
201201
void *payload;
202202
} git_cred_ssh_custom;
203203

@@ -262,7 +262,7 @@ GIT_EXTERN(int) git_cred_ssh_key_new(
262262
GIT_EXTERN(int) git_cred_ssh_interactive_new(
263263
git_cred **out,
264264
const char *username,
265-
git_cred_ssh_interactive_callback prompt_callback,
265+
git_cred_ssh_interactive_cb prompt_callback,
266266
void *payload);
267267

268268
/**
@@ -300,7 +300,7 @@ GIT_EXTERN(int) git_cred_ssh_custom_new(
300300
const char *username,
301301
const char *publickey,
302302
size_t publickey_len,
303-
git_cred_sign_callback sign_callback,
303+
git_cred_sign_cb sign_callback,
304304
void *payload);
305305

306306
/**

src/trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct git_trace_data git_trace__data = {0};
1717

1818
#endif
1919

20-
int git_trace_set(git_trace_level_t level, git_trace_callback callback)
20+
int git_trace_set(git_trace_level_t level, git_trace_cb callback)
2121
{
2222
#ifdef GIT_TRACE
2323
assert(level == 0 || callback != NULL);

src/trace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
struct git_trace_data {
1818
git_trace_level_t level;
19-
git_trace_callback callback;
19+
git_trace_cb callback;
2020
};
2121

2222
extern struct git_trace_data git_trace__data;
@@ -25,7 +25,7 @@ GIT_INLINE(void) git_trace__write_fmt(
2525
git_trace_level_t level,
2626
const char *fmt, ...)
2727
{
28-
git_trace_callback callback = git_trace__data.callback;
28+
git_trace_cb callback = git_trace__data.callback;
2929
git_buf message = GIT_BUF_INIT;
3030
va_list ap;
3131

src/transports/cred.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static int git_cred_ssh_key_type_new(
264264
int git_cred_ssh_interactive_new(
265265
git_cred **out,
266266
const char *username,
267-
git_cred_ssh_interactive_callback prompt_callback,
267+
git_cred_ssh_interactive_cb prompt_callback,
268268
void *payload)
269269
{
270270
git_cred_ssh_interactive *c;
@@ -312,7 +312,7 @@ int git_cred_ssh_custom_new(
312312
const char *username,
313313
const char *publickey,
314314
size_t publickey_len,
315-
git_cred_sign_callback sign_callback,
315+
git_cred_sign_cb sign_callback,
316316
void *payload)
317317
{
318318
git_cred_ssh_custom *c;

0 commit comments

Comments
 (0)