From: Junio C Hamano Date: Thu, 16 Oct 2014 21:16:45 +0000 (-0700) Subject: Merge branch 'bw/trace-no-inline-getnanotime' X-Git-Tag: v2.2.0-rc0~44 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/c11dc64722fc0bb496efb1b6de87012a132c04fc?ds=inline;hp=-c Merge branch 'bw/trace-no-inline-getnanotime' No file-scope static variables in an inlined function, please. * bw/trace-no-inline-getnanotime: trace.c: do not mark getnanotime() as "inline" --- c11dc64722fc0bb496efb1b6de87012a132c04fc diff --combined trace.c index b6f25a23fd,03990df747..4778608941 --- a/trace.c +++ b/trace.c @@@ -216,7 -216,7 +216,7 @@@ void trace_argv_printf(const char **arg 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); } @@@ -298,12 -298,13 +298,12 @@@ void trace_repo_setup(const char *prefi { 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)"; @@@ -315,8 -316,6 +315,8 @@@ 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) @@@ -385,7 -384,7 +385,7 @@@ static inline uint64_t gettimeofday_nan * 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) {