diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-03-12 12:22:20 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-03-12 22:11:32 +0000 |
commit | 2519115695634258b1b492cc07c8feb8dc925b2f (patch) | |
tree | 3d2e0cab5af83af2a46c5814c5265eaaa244bb1d /wsutil | |
parent | 1a52e085c1bc2afe770693b0f8c6a2530aa196d5 (diff) |
Remove some unused or hard-coded header checks.
Remove some unused checks and code found using
grep -o 'HAVE_[A-Z0-9_]*' ConfigureChecks.cmake | sort -u \
| while read have_h ; do echo = $have_h ; git --no-pager grep -cl $have_h ; done
Change-Id: I86bfcfdc4f60d9d7de87017a7bb00f833a79bd2c
Reviewed-on: https://code.wireshark.org/review/26451
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/tempfile.c | 87 | ||||
-rw-r--r-- | wsutil/tempfile.h | 12 |
2 files changed, 0 insertions, 99 deletions
diff --git a/wsutil/tempfile.c b/wsutil/tempfile.c index 3d6c6edc7b..de5314843b 100644 --- a/wsutil/tempfile.c +++ b/wsutil/tempfile.c @@ -77,50 +77,6 @@ mkstemps(char *path_template, int suffixlen) #endif /* HAVE_MKSTEMPS */ -#ifndef HAVE_MKDTEMP -/* Generate a unique temporary directory name from TEMPLATE. - The last six characters of TEMPLATE must be TMP_FILE_SUFFIX; - they are replaced with a string that makes the filename unique. - Returns 0 on success or -1 on error (from mkdir(2)). */ -char * -mkdtemp (char *path_template) -{ - static const char letters[] - = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - size_t len; - size_t i; - - len = strlen (path_template); - if (len < 6 || strcmp (&path_template[len - 6], TMP_FILE_SUFFIX)) - { - __set_errno (EINVAL); - return NULL; - } - - if (g_snprintf (&path_template[len - 5], 6, "%.5u", - (unsigned int) ws_getpid () % 100000) != 5) - /* Inconceivable lossage. */ - return NULL; - - for (i = 0; i < sizeof (letters); ++i) - { - int ret; - - path_template[len - 6] = letters[i]; - - ret = ws_mkdir(path_template, 0700); - if (ret >= 0) - return path_template; - } - - /* We return the null string if we can't find a unique file name. */ - - path_template[0] = '\0'; - return NULL; -} - -#endif /* HAVE_MKDTEMP */ - /* * Construct and return the path name of a file in the * appropriate temporary file directory. @@ -220,49 +176,6 @@ create_tempfile(char **namebuf, const char *pfx, const char *sfx) return fd; } -/** - * Create a directory with the given prefix (e.g. "wireshark"). The path - * is created using g_get_tmp_dir and mkdtemp. - * - * @param namebuf - * @param pfx A prefix for the temporary directory. - * @return The temporary directory path on success, or NULL on failure. - * Must NOT be freed. - */ -const char * -create_tempdir(char **namebuf, const char *pfx) -{ - static char *td_path[3]; - static int td_path_len[3]; - static int idx; - const char *tmp_dir; - - idx = (idx + 1) % 3; - - /* - * Allocate the buffer if it's not already allocated. - */ - if (td_path[idx] == NULL) { - td_path_len[idx] = INITIAL_PATH_SIZE; - td_path[idx] = (char *)g_malloc(td_path_len[idx]); - } - - /* - * We can't use get_tempfile_path here because we're called from dumpcap.c. - */ - tmp_dir = g_get_tmp_dir(); - - while (g_snprintf(td_path[idx], td_path_len[idx], "%s%c%s" TMP_FILE_SUFFIX, tmp_dir, G_DIR_SEPARATOR, pfx) > td_path_len[idx]) { - td_path_len[idx] *= 2; - td_path[idx] = (char *)g_realloc(td_path[idx], td_path_len[idx]); - } - - if (namebuf) { - *namebuf = td_path[idx]; - } - return mkdtemp(td_path[idx]); -} - /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/wsutil/tempfile.h b/wsutil/tempfile.h index c528aedaad..6f20c2fbf4 100644 --- a/wsutil/tempfile.h +++ b/wsutil/tempfile.h @@ -44,18 +44,6 @@ WS_DLL_PUBLIC char *get_tempfile_path(const char *filename); */ WS_DLL_PUBLIC int create_tempfile(char **namebuf, const char *pfx, const char *sfx); -/** - * Create a directory with the given prefix (e.g. "wireshark"). The path - * is created using g_get_tmp_dir and mkdtemp. - * - * @param namebuf If not NULL, receives the full path of the temp directory. - * Must NOT be freed. - * @param pfx A prefix for the temporary directory. - * @return The temporary directory path on success, or NULL on failure. - * Must NOT be freed. - */ -WS_DLL_PUBLIC const char *create_tempdir(char **namebuf, const char *pfx); - #ifdef __cplusplus } #endif /* __cplusplus */ |