diff options
author | Russell Belfer <rb@github.com> | 2014-04-29 11:29:49 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-05-02 09:21:33 -0700 |
commit | b23b112dfe8eceb39eaaea2d5e60d971c4371aa0 (patch) | |
tree | 56a6c981856e5f1bf830c3b647a8a58838b044f5 /src/trace.c | |
parent | 225aab5d6a611076b22f00ae5a28184d92b5259c (diff) | |
download | libgit2-b23b112dfe8eceb39eaaea2d5e60d971c4371aa0.tar.gz |
Add payloads, bitmaps to trace API
This is a proposed adjustment to the trace APIs. This makes the
trace levels into a bitmask so that they can be selectively enabled
and adds a callback-level payload, plus a message-level payload.
This makes it easier for me to a GIT_TRACE_PERF callbacks that
are simply bypassed if the PERF level is not set.
Diffstat (limited to 'src/trace.c')
-rw-r--r-- | src/trace.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/trace.c b/src/trace.c index ee5039f56..6ee2cf2ce 100644 --- a/src/trace.c +++ b/src/trace.c @@ -17,22 +17,25 @@ struct git_trace_data git_trace__data = {0}; #endif -int git_trace_set(git_trace_level_t level, git_trace_callback callback) +int git_trace_set( + git_trace_level_t level, git_trace_callback cb, void *cb_payload) { #ifdef GIT_TRACE - assert(level == 0 || callback != NULL); + assert(level == 0 || cb != NULL); git_trace__data.level = level; - git_trace__data.callback = callback; + git_trace__data.callback = cb; + git_trace__data.callback_payload = cb_payload; GIT_MEMORY_BARRIER; return 0; #else GIT_UNUSED(level); - GIT_UNUSED(callback); + GIT_UNUSED(cb); + GIT_UNUSED(cb_payload); - giterr_set(GITERR_INVALID, - "This version of libgit2 was not built with tracing."); + giterr_set( + GITERR_INVALID, "This version of libgit2 was not built with tracing."); return -1; #endif } |