Skip to content

Commit 178df69

Browse files
committed
trace: suffix the callbacks with _cb
The trace logging callbacks should match the other callback naming conventions, using the `_cb` suffix instead of a `_callback` suffix.
1 parent 810cefd commit 178df69

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

include/git2/deprecated.h

Lines changed: 15 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`.
@@ -261,6 +262,20 @@ typedef git_cred_ssh_interactive_cb git_cred_ssh_interactive_callback;
261262

262263
/**@}*/
263264

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+
264279
/** @name Deprecated Transfer Progress Types
265280
*
266281
* 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

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

0 commit comments

Comments
 (0)