svn commit: samba r17992 - in branches/SAMBA_4_0/source/lib: ldb/replace replace

tridge at samba.org tridge at samba.org
Fri Sep 1 12:37:17 GMT 2006


Author: tridge
Date: 2006-09-01 12:37:17 +0000 (Fri, 01 Sep 2006)
New Revision: 17992

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17992

Log:

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?

Modified:
   branches/SAMBA_4_0/source/lib/ldb/replace/replace.c
   branches/SAMBA_4_0/source/lib/ldb/replace/timegm.c
   branches/SAMBA_4_0/source/lib/replace/config.m4
   branches/SAMBA_4_0/source/lib/replace/replace.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/replace/replace.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/replace/replace.c	2006-09-01 10:41:27 UTC (rev 17991)
+++ branches/SAMBA_4_0/source/lib/ldb/replace/replace.c	2006-09-01 12:37:17 UTC (rev 17992)
@@ -23,7 +23,7 @@
 #include "includes.h"
 #include "ldb/include/includes.h"
 
-#if !defined(HAVE_STRNLEN) && !defined(_SAMBA_BUILD_)
+#ifndef HAVE_STRNLEN
 /**
  Some platforms don't have strnlen
 **/

Modified: branches/SAMBA_4_0/source/lib/ldb/replace/timegm.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/replace/timegm.c	2006-09-01 10:41:27 UTC (rev 17991)
+++ branches/SAMBA_4_0/source/lib/ldb/replace/timegm.c	2006-09-01 12:37:17 UTC (rev 17992)
@@ -38,7 +38,7 @@
 #include "includes.h"
 #include "ldb/include/includes.h"
 
-#if !defined(HAVE_TIMEGM) && !defined(_SAMBA_BUILD_)
+#ifndef HAVE_TIMEGM
 
 static int is_leap(unsigned y)
 {

Modified: branches/SAMBA_4_0/source/lib/replace/config.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/config.m4	2006-09-01 10:41:27 UTC (rev 17991)
+++ branches/SAMBA_4_0/source/lib/replace/config.m4	2006-09-01 12:37:17 UTC (rev 17992)
@@ -50,7 +50,7 @@
 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>])

Modified: branches/SAMBA_4_0/source/lib/replace/replace.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/replace.c	2006-09-01 10:41:27 UTC (rev 17991)
+++ branches/SAMBA_4_0/source/lib/replace/replace.c	2006-09-01 12:37:17 UTC (rev 17992)
@@ -387,20 +387,6 @@
 }
 #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 @@
 	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



More information about the samba-cvs mailing list