const char *tracecmd_get_tracing_dir(void) { static const char *tracing_dir; if (tracing_dir) return tracing_dir; tracing_dir = tracecmd_find_tracing_dir(); return tracing_dir; }
char *tracecmd_get_tracing_file(const char *name) { static const char *tracing; char *file; if (!tracing) { tracing = tracecmd_find_tracing_dir(); if (!tracing) die("Can't find tracing dir"); } file = malloc_or_die(strlen(tracing) + strlen(name) + 2); if (!file) return NULL; sprintf(file, "%s/%s", tracing, name); return file; }