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