diff options
author | Gerald Combs <gerald@wireshark.org> | 2009-07-01 23:36:51 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2009-07-01 23:36:51 +0000 |
commit | e0ebc32195232e1b5d96aec5f34b64932ba69bca (patch) | |
tree | 026a81373cfcbcfad75164ffeef600e21eacdeb8 /tempfile.h | |
parent | e2890d405324e72c55e93c7d05099ddc1d62064f (diff) |
Updates to create_tempfile:
- Use g_get_tmp_dir, just like get_tempfile_path.
- Don't make the caller worry about the path buffer length.
svn path=/trunk/; revision=28915
Diffstat (limited to 'tempfile.h')
-rw-r--r-- | tempfile.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tempfile.h b/tempfile.h index 1c073e5e2b..95a03794a6 100644 --- a/tempfile.h +++ b/tempfile.h @@ -29,12 +29,21 @@ extern "C" { #endif /* __cplusplus */ -/* create a tempfile with the given prefix (e.g. "ether") - * namebuf (and namebuflen) should be 128+1 bytes long (BTW: why?) - * returns the file descriptor of the new tempfile and - * the name of the new file in namebuf +/** @file + * Convenience function for temporary file creation. */ -int create_tempfile(char *namebuf, int namebuflen, const char *pfx); + + +/** + * Create a tempfile with the given prefix (e.g. "wireshark"). The path + * is created using g_get_tmp_dir and mkstemp. + * + * @param namebuf If not NULL, receives the full path of the temp file. + * Should NOT be freed. + * @param pfx A prefix for the temporary file. + * @return The file descriptor of the new tempfile, from mkstemp(). + */ +int create_tempfile(char **namebuf, const char *pfx); #ifdef __cplusplus } |