From eee9b9ddd30be0b11593a31ecf67672522d7e5ed Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 17 Nov 2013 04:39:44 +0000 Subject: Move get_tempfile_path() from filesystem.[ch] to tempfile.[ch]. svn path=/trunk/; revision=53379 --- wsutil/filesystem.c | 9 --------- wsutil/filesystem.h | 8 -------- wsutil/tempfile.c | 12 +++++++++--- wsutil/tempfile.h | 9 +++++++++ 4 files changed, 18 insertions(+), 20 deletions(-) (limited to 'wsutil') diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index fa292da4ce..e394858bd9 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -1895,15 +1895,6 @@ deletefile(const char *path) return ws_unlink(path) == 0; } -/* - * Construct and return the path name of a file in the - * appropriate temporary file directory. - */ -char *get_tempfile_path(const char *filename) -{ - return g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", g_get_tmp_dir(), filename); -} - /* * Return an error message for UNIX-style errno indications on open or * create operations. diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h index 6b76bab4fc..642ddf9797 100644 --- a/wsutil/filesystem.h +++ b/wsutil/filesystem.h @@ -204,14 +204,6 @@ WS_DLL_PUBLIC char *get_persconffile_path(const char *filename, gboolean from_pr */ WS_DLL_PUBLIC const char *get_persdatafile_dir(void); -/* - * Construct the path name of a file in $TMP/%TEMP% directory. - * Or "/tmp/" (C:\) if that fails. - * - * Return value is g_malloced so the caller should g_free it. - */ -WS_DLL_PUBLIC char *get_tempfile_path(const char *filename); - /* * process command line option belonging to the filesystem settings */ diff --git a/wsutil/tempfile.c b/wsutil/tempfile.c index 2fab0df257..9993a0ea4f 100644 --- a/wsutil/tempfile.c +++ b/wsutil/tempfile.c @@ -146,6 +146,15 @@ mkdtemp (char *template) #endif /* HAVE_MKDTEMP */ +/* + * Construct and return the path name of a file in the + * appropriate temporary file directory. + */ +char *get_tempfile_path(const char *filename) +{ + return g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", g_get_tmp_dir(), filename); +} + #define MAX_TEMPFILES 3 /** @@ -200,9 +209,6 @@ create_tempfile(char **namebuf, const char *pfx) tf[idx].path = (char *)g_malloc(tf[idx].len); } - /* - * We can't use get_tempfile_path here because we're called from dumpcap.c. - */ tmp_dir = g_get_tmp_dir(); #ifdef _WIN32 diff --git a/wsutil/tempfile.h b/wsutil/tempfile.h index 4f9492ed87..f58419f581 100644 --- a/wsutil/tempfile.h +++ b/wsutil/tempfile.h @@ -35,6 +35,15 @@ extern "C" { * Convenience function for temporary file creation. */ +/** + * Construct the path name of a file in the appropriate temporary + * file directory. + * + * @param filename the file name to be given to the file. + * @return the pathname of the file, g_malloced so the caller + * should g_free it. + */ +WS_DLL_PUBLIC char *get_tempfile_path(const char *filename); /** * Create a tempfile with the given prefix (e.g. "wireshark"). The path -- cgit v1.2.3