Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/time apply 2012g via patch
details: https://anonhg.NetBSD.org/src/rev/daeb6525ba77
branches: trunk
changeset: 782256:daeb6525ba77
user: christos <christos%NetBSD.org@localhost>
date: Wed Oct 24 00:10:03 2012 +0000
description:
apply 2012g via patch
diffstat:
lib/libc/time/Makefile | 28 +-
lib/libc/time/asctime.c | 6 +-
lib/libc/time/ialloc.c | 60 +----
lib/libc/time/localtime.c | 30 +-
lib/libc/time/private.h | 15 +-
lib/libc/time/scheck.c | 14 +-
lib/libc/time/strftime.c | 20 +-
lib/libc/time/zdump.c | 117 ++++----
lib/libc/time/zic.c | 610 ++++++++++++++++++---------------------------
9 files changed, 364 insertions(+), 536 deletions(-)
diffs (truncated from 2044 to 300 lines):
diff -r a0ea286b2012 -r daeb6525ba77 lib/libc/time/Makefile
--- a/lib/libc/time/Makefile Tue Oct 23 23:31:00 2012 +0000
+++ b/lib/libc/time/Makefile Wed Oct 24 00:10:03 2012 +0000
@@ -3,7 +3,7 @@
# 2009-05-17 by Arthur David Olson.
# Version numbers of the code and data distributions.
-VERSION = 2012e
+VERSION = 2012g
# Change the line below for your time zone (after finding the zone you want in
# the time zone files, or adding it to a time zone file).
@@ -120,10 +120,18 @@
# -DZIC_MAX_ABBR_LEN_WO_WARN=3
# (or some other number) to set the maximum time zone abbreviation length
# that zic will accept without a warning (the default is 6)
-GCC_DEBUG_FLAGS = -Dlint -g -O3 -fno-common \
- -Wall -Wcast-qual -Wconversion -Wmissing-prototypes \
- -Wnested-externs -Wpointer-arith -Wshadow \
- -Wtraditional # -Wstrict-prototypes -Wwrite-strings
+GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
+ -Wall -Wextra \
+ -Wbad-function-cast -Wcast-align -Wcast-qual \
+ -Wformat=2 -Winit-self \
+ -Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \
+ -Wnested-externs \
+ -Wno-format-nonliteral -Wno-sign-compare -Wno-sign-conversion \
+ -Wno-type-limits \
+ -Wno-unused-parameter -Woverlength-strings -Wpointer-arith \
+ -Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
+ -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wtrampolines \
+ -Wwrite-strings
#
# If you want to use System V compatibility code, add
# -DUSG_COMPAT
@@ -276,7 +284,8 @@
SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) tzselect.ksh
MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
tzfile.5 tzselect.8 zic.8 zdump.8
-DOCS= README Theory $(MANS) date.1 Makefile
+COMMON= Makefile
+DOCS= README Theory $(MANS) date.1
PRIMARY_YDATA= africa antarctica asia australasia \
europe northamerica southamerica
YDATA= $(PRIMARY_YDATA) pacificnew etcetera backward
@@ -289,7 +298,7 @@
MISC= usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \
$(WEB_PAGES) checktab.awk workman.sh \
zoneinfo2tdf.pl
-ENCHILADA= $(DOCS) $(SOURCES) $(DATA) $(MISC)
+ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
# And for the benefit of csh users on systems that assume the user
# shell should be used to handle commands in Makefiles. . .
@@ -437,10 +446,11 @@
done
$(AWK) -f checktab.awk $(PRIMARY_YDATA)
LC_ALL=C && export LC_ALL && \
- tar $(TARFLAGS) -cf - $(DOCS) $(SOURCES) $(MISC) *.[1-8].txt | \
+ tar $(TARFLAGS) -cf - \
+ $(COMMON) $(DOCS) $(SOURCES) $(MISC) *.[1-8].txt | \
gzip $(GZIPFLAGS) > tzcode$(VERSION).tar.gz
LC_ALL=C && export LC_ALL && \
- tar $(TARFLAGS) -cf - $(DATA) | \
+ tar $(TARFLAGS) -cf - $(COMMON) $(DATA) | \
gzip $(GZIPFLAGS) > tzdata$(VERSION).tar.gz
typecheck:
diff -r a0ea286b2012 -r daeb6525ba77 lib/libc/time/asctime.c
--- a/lib/libc/time/asctime.c Tue Oct 23 23:31:00 2012 +0000
+++ b/lib/libc/time/asctime.c Wed Oct 24 00:10:03 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asctime.c,v 1.15 2012/06/25 22:32:46 abs Exp $ */
+/* $NetBSD: asctime.c,v 1.16 2012/10/24 00:10:03 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
@@ -16,7 +16,7 @@
#if 0
static char elsieid[] = "@(#)asctime.c 8.5";
#else
-__RCSID("$NetBSD: asctime.c,v 1.15 2012/06/25 22:32:46 abs Exp $");
+__RCSID("$NetBSD: asctime.c,v 1.16 2012/10/24 00:10:03 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -94,7 +94,7 @@
#define ASCTIME_BUFLEN (3 * 2 + 5 * INT_STRLEN_MAXIMUM(int) + 3 + 2 + 1 + 1)
char *
-asctime_r(const struct tm * timeptr, char * buf)
+asctime_r(const struct tm *timeptr, char *buf)
{
static const char *wday_name[7] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
diff -r a0ea286b2012 -r daeb6525ba77 lib/libc/time/ialloc.c
--- a/lib/libc/time/ialloc.c Tue Oct 23 23:31:00 2012 +0000
+++ b/lib/libc/time/ialloc.c Wed Oct 24 00:10:03 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ialloc.c,v 1.7 2010/01/02 10:42:49 tsutsui Exp $ */
+/* $NetBSD: ialloc.c,v 1.8 2012/10/24 00:10:03 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
** 2006-07-17 by Arthur David Olson.
@@ -13,44 +13,13 @@
#if 0
static char elsieid[] = "@(#)ialloc.c 8.30";
#else
-__RCSID("$NetBSD: ialloc.c,v 1.7 2010/01/02 10:42:49 tsutsui Exp $");
+__RCSID("$NetBSD: ialloc.c,v 1.8 2012/10/24 00:10:03 christos Exp $");
#endif
#include "private.h"
-#define nonzero(n) (((n) == 0) ? 1 : (n))
-
char *
-imalloc(n)
-const int n;
-{
- return malloc((size_t) nonzero(n));
-}
-
-char *
-icalloc(nelem, elsize)
-int nelem;
-int elsize;
-{
- if (nelem == 0 || elsize == 0)
- nelem = elsize = 1;
- return calloc((size_t) nelem, (size_t) elsize);
-}
-
-void *
-irealloc(pointer, size)
-void * const pointer;
-const int size;
-{
- if (pointer == NULL)
- return imalloc(size);
- return realloc((void *) pointer, (size_t) nonzero(size));
-}
-
-char *
-icatalloc(old, new)
-char * const old;
-const char * const new;
+icatalloc(char *const old, const char *const new)
{
register char * result;
register int oldsize, newsize;
@@ -62,31 +31,14 @@
return old;
else
oldsize = strlen(old);
- if ((result = irealloc(old, oldsize + newsize + 1)) != NULL)
+ if ((result = realloc(old, oldsize + newsize + 1)) != NULL)
if (new != NULL)
(void) strcpy(result + oldsize, new); /* XXX strcpy is safe */
return result;
}
char *
-icpyalloc(string)
-const char * const string;
-{
- return icatalloc((char *) NULL, string);
-}
-
-void
-ifree(p)
-char * const p;
+icpyalloc(const char *const string)
{
- if (p != NULL)
- (void) free(p);
+ return icatalloc(NULL, string);
}
-
-void
-icfree(p)
-char * const p;
-{
- if (p != NULL)
- (void) free(p);
-}
diff -r a0ea286b2012 -r daeb6525ba77 lib/libc/time/localtime.c
--- a/lib/libc/time/localtime.c Tue Oct 23 23:31:00 2012 +0000
+++ b/lib/libc/time/localtime.c Wed Oct 24 00:10:03 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: localtime.c,v 1.67 2012/03/20 16:39:08 matt Exp $ */
+/* $NetBSD: localtime.c,v 1.68 2012/10/24 00:10:03 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
#if 0
static char elsieid[] = "@(#)localtime.c 8.17";
#else
-__RCSID("$NetBSD: localtime.c,v 1.67 2012/03/20 16:39:08 matt Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.68 2012/10/24 00:10:03 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -155,8 +155,8 @@
static long detzcode(const char * codep);
static time_t detzcode64(const char * codep);
static int differ_by_repeat(time_t t1, time_t t0);
-static const char * getzname(const char * strp);
-static const char * getqzname(const char * strp, const int delim);
+static const char * getzname(const char * strp) __pure;
+static const char * getqzname(const char * strp, const int delim) __pure;
static const char * getnum(const char * strp, int * nump, int min,
int max);
static const char * getsecs(const char * strp, long * secsp);
@@ -168,7 +168,7 @@
static struct tm * localsub(const timezone_t sp, const time_t *timep,
long offset, struct tm *tmp);
static int increment_overflow(int * number, int delta);
-static int leaps_thru_end_of(int y);
+static int leaps_thru_end_of(int y) __pure;
static int long_increment_overflow(long * number, int delta);
static int long_normalize_overflow(long * tensptr,
int * unitsptr, int base);
@@ -176,7 +176,7 @@
int base);
static void settzname(void);
static time_t time1(const timezone_t sp, struct tm * const tmp,
- subfun_t funcp, long offset);
+ subfun_t funcp, const long offset);
static time_t time2(const timezone_t sp, struct tm * const tmp,
subfun_t funcp,
const long offset, int *const okayp);
@@ -188,7 +188,7 @@
static int tmcomp(const struct tm * atmp,
const struct tm * btmp);
static time_t transtime(time_t janfirst, int year,
- const struct rule * rulep, long offset);
+ const struct rule * rulep, long offset) __pure;
static int typesequiv(const timezone_t sp, int a, int b);
static int tzload(timezone_t sp, const char * name,
int doextend);
@@ -696,7 +696,7 @@
*/
static const char *
-getnum(const char *strp, int * const nump, const int min, const int max)
+getnum(const char *strp, int *const nump, const int min, const int max)
{
char c;
int num;
@@ -1430,7 +1430,7 @@
*/
static struct tm *
-gmtsub(const timezone_t sp, const time_t * const timep, const long offset,
+gmtsub(const timezone_t sp, const time_t *const timep, const long offset,
struct tm *const tmp)
{
struct tm * result;
@@ -1712,7 +1712,7 @@
*/
static int
-increment_overflow(int *ip, int j)
+increment_overflow(int *const ip, int j)
{
int i = *ip;
@@ -1729,7 +1729,7 @@
}
static int
-long_increment_overflow(long *lp, int m)
+long_increment_overflow(long *const lp, int m)
{
long l = *lp;
@@ -2009,7 +2009,7 @@
static time_t
time1(const timezone_t sp, struct tm *const tmp, subfun_t funcp,
- long offset)
+ const long offset)
{
time_t t;
int samei, otheri;
@@ -2082,7 +2082,7 @@
}
time_t
-mktime_z(const timezone_t sp, struct tm *tmp)
+mktime_z(const timezone_t sp, struct tm *const tmp)
{
time_t t;
if (sp == NULL)
@@ -2093,7 +2093,7 @@
}
time_t
Home |
Main Index |
Thread Index |
Old Index