diff options
Diffstat (limited to 'libhfcommon/util.c')
-rw-r--r-- | libhfcommon/util.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/libhfcommon/util.c b/libhfcommon/util.c index 51ec608e..e40a608f 100644 --- a/libhfcommon/util.c +++ b/libhfcommon/util.c @@ -24,7 +24,6 @@ #include "libhfcommon/util.h" #include <ctype.h> -#include <errno.h> #include <fcntl.h> #include <inttypes.h> #include <math.h> @@ -181,13 +180,6 @@ int util_ssnprintf(char* str, size_t size, const char* format, ...) { return ret; } -bool util_strStartsWith(const char* str, const char* tofind) { - if (strncmp(str, tofind, strlen(tofind)) == 0) { - return true; - } - return false; -} - void util_getLocalTime(const char* fmt, char* buf, size_t len, time_t tm) { struct tm ltime; localtime_r(&tm, <ime); @@ -205,13 +197,13 @@ void util_closeStdio(bool close_stdin, bool close_stdout, bool close_stderr) { } if (close_stdin) { - TEMP_FAILURE_RETRY(dup2(fd, STDIN_FILENO)); + dup2(fd, STDIN_FILENO); } if (close_stdout) { - TEMP_FAILURE_RETRY(dup2(fd, STDOUT_FILENO)); + dup2(fd, STDOUT_FILENO); } if (close_stderr) { - TEMP_FAILURE_RETRY(dup2(fd, STDERR_FILENO)); + dup2(fd, STDERR_FILENO); } if (fd > STDERR_FILENO) { @@ -243,17 +235,6 @@ int64_t util_timeNowMillis(void) { return (((int64_t)tv.tv_sec * 1000LL) + ((int64_t)tv.tv_usec / 1000LL)); } -void util_sleepForMSec(uint64_t msec) { - if (msec == 0) { - return; - } - struct timespec ts = { - .tv_sec = msec / 1000U, - .tv_nsec = (msec % 1000U) * 1000000U, - }; - TEMP_FAILURE_RETRY(nanosleep(&ts, &ts)); -} - uint64_t util_getUINT32(const uint8_t* buf) { uint32_t r; memcpy(&r, buf, sizeof(r)); |