Module Name: src
Committed By: christos
Date: Wed Jul 17 23:09:26 UTC 2013
Modified Files:
src/lib/libc/time: localtime.c scheck.c strftime.c zdump.c
Log Message:
remove "register" in new code
fix backwards check for overflow
To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/time/scheck.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/time/zdump.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.74 src/lib/libc/time/localtime.c:1.75
--- src/lib/libc/time/localtime.c:1.74 Wed Jul 17 16:13:04 2013
+++ src/lib/libc/time/localtime.c Wed Jul 17 19:09:26 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: localtime.c,v 1.74 2013/07/17 20:13:04 christos Exp $ */
+/* $NetBSD: localtime.c,v 1.75 2013/07/17 23:09:26 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.74 2013/07/17 20:13:04 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.75 2013/07/17 23:09:26 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -1538,7 +1538,7 @@ offtime(const time_t *const timep, long
struct tm *tmp;
if ((offset > 0 && offset > INT_FAST32_MAX) ||
- (offset < 0 && offset > INT_FAST32_MIN)) {
+ (offset < 0 && offset < INT_FAST32_MIN)) {
errno = EOVERFLOW;
return NULL;
}
@@ -1554,7 +1554,7 @@ struct tm *
offtime_r(const time_t *timep, long offset, struct tm *tmp)
{
if ((offset > 0 && offset > INT_FAST32_MAX) ||
- (offset < 0 && offset > INT_FAST32_MIN)) {
+ (offset < 0 && offset < INT_FAST32_MIN)) {
errno = EOVERFLOW;
return NULL;
}
@@ -2189,7 +2189,7 @@ timeoff(struct tm *const tmp, long offse
time_t t;
if ((offset > 0 && offset > INT_FAST32_MAX) ||
- (offset < 0 && offset > INT_FAST32_MIN)) {
+ (offset < 0 && offset < INT_FAST32_MIN)) {
errno = EOVERFLOW;
return -1;
}
Index: src/lib/libc/time/scheck.c
diff -u src/lib/libc/time/scheck.c:1.10 src/lib/libc/time/scheck.c:1.11
--- src/lib/libc/time/scheck.c:1.10 Wed Jul 17 16:13:04 2013
+++ src/lib/libc/time/scheck.c Wed Jul 17 19:09:26 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: scheck.c,v 1.10 2013/07/17 20:13:04 christos Exp $ */
+/* $NetBSD: scheck.c,v 1.11 2013/07/17 23:09:26 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
@@ -15,7 +15,7 @@
#if 0
static char elsieid[] = "@(#)scheck.c 8.19";
#else
-__RCSID("$NetBSD: scheck.c,v 1.10 2013/07/17 20:13:04 christos Exp $");
+__RCSID("$NetBSD: scheck.c,v 1.11 2013/07/17 23:09:26 christos Exp $");
#endif
#endif /* !defined lint */
@@ -26,12 +26,12 @@ __RCSID("$NetBSD: scheck.c,v 1.10 2013/0
const char *
scheck(const char *const string, const char *const format)
{
- register char * fbuf;
- register const char * fp;
- register char * tp;
- register int c;
- register const char * result;
- char dummy;
+ char * fbuf;
+ const char * fp;
+ char * tp;
+ int c;
+ const char * result;
+ char dummy;
result = "";
if (string == NULL || format == NULL)
Index: src/lib/libc/time/strftime.c
diff -u src/lib/libc/time/strftime.c:1.27 src/lib/libc/time/strftime.c:1.28
--- src/lib/libc/time/strftime.c:1.27 Wed Jul 17 16:13:04 2013
+++ src/lib/libc/time/strftime.c Wed Jul 17 19:09:26 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: strftime.c,v 1.27 2013/07/17 20:13:04 christos Exp $ */
+/* $NetBSD: strftime.c,v 1.28 2013/07/17 23:09:26 christos Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
@@ -6,7 +6,7 @@
static char elsieid[] = "@(#)strftime.c 7.64";
static char elsieid[] = "@(#)strftime.c 8.3";
#else
-__RCSID("$NetBSD: strftime.c,v 1.27 2013/07/17 20:13:04 christos Exp $");
+__RCSID("$NetBSD: strftime.c,v 1.28 2013/07/17 23:09:26 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -645,8 +645,8 @@ static char *
_yconv(const int a, const int b, const int convert_top, const int convert_yy,
char *pt, const char *const ptlim)
{
- register int lead;
- register int trail;
+ int lead;
+ int trail;
#define DIVISOR 100
trail = a % DIVISOR + b % DIVISOR;
Index: src/lib/libc/time/zdump.c
diff -u src/lib/libc/time/zdump.c:1.29 src/lib/libc/time/zdump.c:1.30
--- src/lib/libc/time/zdump.c:1.29 Wed Jul 17 16:13:04 2013
+++ src/lib/libc/time/zdump.c Wed Jul 17 19:09:26 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: zdump.c,v 1.29 2013/07/17 20:13:04 christos Exp $ */
+/* $NetBSD: zdump.c,v 1.30 2013/07/17 23:09:26 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
** 2009-05-17 by Arthur David Olson.
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: zdump.c,v 1.29 2013/07/17 20:13:04 christos Exp $");
+__RCSID("$NetBSD: zdump.c,v 1.30 2013/07/17 23:09:26 christos Exp $");
#endif /* !defined lint */
#include "version.h"
@@ -380,8 +380,8 @@ main(int argc, char *argv[])
intmax_t lo;
intmax_t hi;
char dummy;
- register intmax_t cutloyear = ZDUMP_LO_YEAR;
- register intmax_t cuthiyear = ZDUMP_HI_YEAR;
+ intmax_t cutloyear = ZDUMP_LO_YEAR;
+ intmax_t cuthiyear = ZDUMP_HI_YEAR;
if (cutarg != NULL) {
if (sscanf(cutarg, "%"SCNdMAX"%c", &hi, &dummy) == 1) {
cuthiyear = hi;