summaryrefslogtreecommitdiff
path: root/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace.c')
-rw-r--r--trace.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/trace.c b/trace.c
index 7149651..f6f9f3a 100644
--- a/trace.c
+++ b/trace.c
@@ -214,7 +214,7 @@ void trace_argv_printf(const char **argv, const char *format, ...)
va_end(ap);
}
-void trace_strbuf(const char *key, const struct strbuf *data)
+void trace_strbuf(struct trace_key *key, const struct strbuf *data)
{
trace_strbuf_fl(NULL, 0, key, data);
}
@@ -296,13 +296,12 @@ void trace_repo_setup(const char *prefix)
{
static struct trace_key key = TRACE_KEY_INIT(SETUP);
const char *git_work_tree;
- char cwd[PATH_MAX];
+ char *cwd;
if (!trace_want(&key))
return;
- if (!getcwd(cwd, PATH_MAX))
- die("Unable to get current working directory");
+ cwd = xgetcwd();
if (!(git_work_tree = get_git_work_tree()))
git_work_tree = "(null)";
@@ -314,6 +313,8 @@ void trace_repo_setup(const char *prefix)
trace_printf_key(&key, "setup: worktree: %s\n", quote_crnl(git_work_tree));
trace_printf_key(&key, "setup: cwd: %s\n", quote_crnl(cwd));
trace_printf_key(&key, "setup: prefix: %s\n", quote_crnl(prefix));
+
+ free(cwd);
}
int trace_want(struct trace_key *key)
@@ -382,7 +383,7 @@ static inline uint64_t gettimeofday_nanos(void)
* Returns nanoseconds since the epoch (01/01/1970), for performance tracing
* (i.e. favoring high precision over wall clock time accuracy).
*/
-inline uint64_t getnanotime(void)
+uint64_t getnanotime(void)
{
static uint64_t offset;
if (offset > 1) {