summaryrefslogtreecommitdiff
path: root/src/support/filename.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/support/filename.c')
-rw-r--r--src/support/filename.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/support/filename.c b/src/support/filename.c
new file mode 100644
index 00000000000..a886b3f09f9
--- /dev/null
+++ b/src/support/filename.c
@@ -0,0 +1,30 @@
+/*-
+ * Copyright (c) 2008-2012 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * See the file LICENSE for redistribution information.
+ */
+
+#include "wt_internal.h"
+
+/*
+ * __wt_filename --
+ * Build a filename in a scratch buffer.
+ */
+int
+__wt_filename(WT_SESSION_IMPL *session, const char *name, const char **path)
+{
+ WT_CONNECTION_IMPL *conn;
+ size_t len;
+ char *buf;
+
+ conn = S2C(session);
+ *path = NULL;
+
+ len = strlen(conn->home) + 1 + strlen(name) + 1;
+ WT_RET(__wt_calloc(session, 1, len, &buf));
+ snprintf(buf, len, "%s/%s", conn->home, name);
+
+ *path = buf;
+ return (0);
+}