line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
* Copyright (C) the libgit2 contributors. All rights reserved. |
3
|
|
|
|
|
|
|
* |
4
|
|
|
|
|
|
|
* This file is part of libgit2, distributed under the GNU GPL v2 with |
5
|
|
|
|
|
|
|
* a Linking Exception. For full terms see the included COPYING file. |
6
|
|
|
|
|
|
|
*/ |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#include "trace.h" |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#include "buffer.h" |
11
|
|
|
|
|
|
|
#include "global.h" |
12
|
|
|
|
|
|
|
#include "git2/trace.h" |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#ifdef GIT_TRACE |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
struct git_trace_data git_trace__data = {0}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#endif |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
int git_trace_set(git_trace_level_t level, git_trace_cb callback) |
21
|
|
|
|
|
|
|
{ |
22
|
|
|
|
|
|
|
#ifdef GIT_TRACE |
23
|
|
|
|
|
|
|
assert(level == 0 || callback != NULL); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
git_trace__data.level = level; |
26
|
|
|
|
|
|
|
git_trace__data.callback = callback; |
27
|
|
|
|
|
|
|
GIT_MEMORY_BARRIER; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return 0; |
30
|
|
|
|
|
|
|
#else |
31
|
|
|
|
|
|
|
GIT_UNUSED(level); |
32
|
|
|
|
|
|
|
GIT_UNUSED(callback); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
git_error_set(GIT_ERROR_INVALID, |
35
|
|
|
|
|
|
|
"this version of libgit2 was not built with tracing."); |
36
|
0
|
|
|
|
|
|
return -1; |
37
|
|
|
|
|
|
|
#endif |
38
|
|
|
|
|
|
|
} |