From 12c78adc8f54d5a8b31471bd578367157d10ec3a Mon Sep 17 00:00:00 2001 From: Thomas Otto Date: Thu, 19 Mar 2020 22:51:14 +0100 Subject: [PATCH] Remove legacy strtok_r() --- configure.ac | 1 - src/legacy_util.cpp | 24 ------------------------ src/legacy_util.hpp | 3 --- 3 files changed, 28 deletions(-) diff --git a/configure.ac b/configure.ac index 1b2bf2919..f5baba394 100644 --- a/configure.ac +++ b/configure.ac @@ -129,7 +129,6 @@ AC_CHECK_FUNCS(mkstemp) AC_CHECK_FUNCS(realpath) AC_CHECK_FUNCS(setenv) AC_CHECK_FUNCS(strndup) -AC_CHECK_FUNCS(strtok_r) AC_CHECK_FUNCS(syslog) AC_CHECK_FUNCS(unsetenv) AC_CHECK_FUNCS(utimes) diff --git a/src/legacy_util.cpp b/src/legacy_util.cpp index fc9134c20..4208ed970 100644 --- a/src/legacy_util.cpp +++ b/src/legacy_util.cpp @@ -612,30 +612,6 @@ localtime_r(const time_t* timep, struct tm* result) } #endif -#ifndef HAVE_STRTOK_R -// strtok_r replacement. -char* -strtok_r(char* str, const char* delim, char** saveptr) -{ - if (!str) { - str = *saveptr; - } - int len = strlen(str); - char* ret = strtok(str, delim); - if (ret) { - char* save = ret; - while (*save++) { - // Do nothing. - } - if ((len + 1) == (intptr_t)(save - str)) { - save--; - } - *saveptr = save; - } - return ret; -} -#endif - // Create an empty temporary file. *fname will be reallocated and set to the // resulting filename. Returns an open file descriptor to the file. int diff --git a/src/legacy_util.hpp b/src/legacy_util.hpp index bb3ccb13d..782c77bf9 100644 --- a/src/legacy_util.hpp +++ b/src/legacy_util.hpp @@ -48,9 +48,6 @@ bool parse_size_with_suffix(const char* str, uint64_t* size); #ifndef HAVE_LOCALTIME_R struct tm* localtime_r(const time_t* timep, struct tm* result); #endif -#ifndef HAVE_STRTOK_R -char* strtok_r(char* str, const char* delim, char** saveptr); -#endif int create_tmp_fd(char** fname); FILE* create_tmp_file(char** fname, const char* mode); const char* get_home_directory(); -- 2.47.2