svn commit: samba r18044 - in branches/SAMBA_4_0/source/lib/replace: .

tridge at samba.org tridge at samba.org
Mon Sep 4 13:35:03 GMT 2006


Author: tridge
Date: 2006-09-04 13:35:03 +0000 (Mon, 04 Sep 2006)
New Revision: 18044

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

Log:

timegm.c needs to be in a separate file

Modified:
   branches/SAMBA_4_0/source/lib/replace/Makefile.in
   branches/SAMBA_4_0/source/lib/replace/replace.c
   branches/SAMBA_4_0/source/lib/replace/timegm.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/Makefile.in
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/Makefile.in	2006-09-04 13:28:54 UTC (rev 18043)
+++ branches/SAMBA_4_0/source/lib/replace/Makefile.in	2006-09-04 13:35:03 UTC (rev 18044)
@@ -11,7 +11,7 @@
 
 CFLAGS=-I. -I$(srcdir) @CFLAGS@
 
-OBJS = dlfcn.o getpass.o replace.o snprintf.o
+OBJS = dlfcn.o getpass.o replace.o snprintf.o timegm.o
 
 all: libreplace.a testsuite
 

Modified: branches/SAMBA_4_0/source/lib/replace/replace.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/replace.c	2006-09-04 13:28:54 UTC (rev 18043)
+++ branches/SAMBA_4_0/source/lib/replace/replace.c	2006-09-04 13:35:03 UTC (rev 18044)
@@ -468,7 +468,7 @@
 {
 	char *dname;
 	
-	if (dname = mktemp(template)) {
+	if ((dname = mktemp(template))) {
 		if (mkdir(dname, 0700) >= 0) {
 			return dname;
 		}
@@ -603,34 +603,3 @@
 }
 #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

Modified: branches/SAMBA_4_0/source/lib/replace/timegm.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/timegm.c	2006-09-04 13:28:54 UTC (rev 18043)
+++ branches/SAMBA_4_0/source/lib/replace/timegm.c	2006-09-04 13:35:03 UTC (rev 18044)
@@ -35,8 +35,8 @@
   adapted for Samba4 by Andrew Tridgell
 */
 
-#include "includes.h"
-#include "ldb/include/includes.h"
+#include "replace.h"
+#include <stdlib.h>
 
 #ifndef HAVE_TIMEGM
 



More information about the samba-cvs mailing list