diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-09-01 12:37:17 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:17:02 -0500 |
commit | 0bb1c2da0e4164b448c6b7cc988f59b59225802c (patch) | |
tree | cf6aa875aafa9b60550c2e929773f3cc49b1b05e /source4/lib/replace | |
parent | bb71578696ad87e2848a7d05aac5c284f760a187 (diff) | |
download | samba-0bb1c2da0e4164b448c6b7cc988f59b59225802c.tar.gz samba-0bb1c2da0e4164b448c6b7cc988f59b59225802c.tar.bz2 samba-0bb1c2da0e4164b448c6b7cc988f59b59225802c.zip |
r17992: reverted r17842
This needs more consideration, as the patch removed the copyright
notice and license from the timegm.c code.
Volker, when you get a minute can you let me know what problem this
patch fixed so I can find a different approach?
(This used to be commit 5b9b9dd5303300778bb9e6d0479ab03fdd70c67d)
Diffstat (limited to 'source4/lib/replace')
-rw-r--r-- | source4/lib/replace/config.m4 | 2 | ||||
-rw-r--r-- | source4/lib/replace/replace.c | 46 |
2 files changed, 1 insertions, 47 deletions
diff --git a/source4/lib/replace/config.m4 b/source4/lib/replace/config.m4 index adaba74568..93f0bb34a7 100644 --- a/source4/lib/replace/config.m4 +++ b/source4/lib/replace/config.m4 @@ -50,7 +50,7 @@ AC_CHECK_HEADERS(sys/syslog.h syslog.h) AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror) AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename) AC_CHECK_FUNCS(waitpid strlcpy strlcat innetgr initgroups memmove strdup) -AC_CHECK_FUNCS(pread pwrite strndup strnlen strcasestr strtok_r mkdtemp) +AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp) AC_HAVE_DECL(setresuid, [#include <unistd.h>]) AC_HAVE_DECL(setresgid, [#include <unistd.h>]) AC_HAVE_DECL(errno, [#include <errno.h>]) diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index f8bd62109d..b8f4bc1c3c 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -387,20 +387,6 @@ duplicate a string } #endif -#ifndef HAVE_STRNLEN -/** - Some platforms don't have strnlen -**/ - - size_t strnlen(const char *s, size_t n) -{ - size_t i; - for (i=0; i<n && s[i] != '\0'; i++) - /* noop */ ; - return i; -} -#endif - #ifndef HAVE_WAITPID int waitpid(pid_t pid,int *status,int options) { @@ -533,35 +519,3 @@ char *strtok_r(char *s, const char *delim, char **save_ptr) return token; } #endif - -#if !defined(HAVE_TIMEGM) - -static int is_leap(unsigned y) -{ - y += 1900; - return (y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0); -} - -time_t timegm(struct tm *tm) -{ - static const unsigned ndays[2][12] ={ - {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, - {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}}; - time_t res = 0; - unsigned i; - - for (i = 70; i < tm->tm_year; ++i) - res += is_leap(i) ? 366 : 365; - - for (i = 0; i < tm->tm_mon; ++i) - res += ndays[is_leap(tm->tm_year)][i]; - res += tm->tm_mday - 1; - res *= 24; - res += tm->tm_hour; - res *= 60; - res += tm->tm_min; - res *= 60; - res += tm->tm_sec; - return res; -} -#endif |