pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/libnbcompat/files Sync to lib/libc/stdlib/str...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f1ada30e4743
branches:  trunk
changeset: 465037:f1ada30e4743
user:      grant <grant%pkgsrc.org@localhost>
date:      Fri Dec 19 22:40:04 2003 +0000

description:
Sync to lib/libc/stdlib/strtoll.c 1.6:
    *   Use LLONG_{MIN,MAX} instead of QUAD_{MIN,MAX}
    *   Use "long long int" instead of "long long"
    *   Appease lint
    *   Use "long long" instead of "quad" in comments.

diffstat:

 pkgtools/libnbcompat/files/strtoll.c |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (68 lines):

diff -r 6af9ca680548 -r f1ada30e4743 pkgtools/libnbcompat/files/strtoll.c
--- a/pkgtools/libnbcompat/files/strtoll.c      Fri Dec 19 22:27:01 2003 +0000
+++ b/pkgtools/libnbcompat/files/strtoll.c      Fri Dec 19 22:40:04 2003 +0000
@@ -1,4 +1,5 @@
-/*     $NetBSD: strtoll.c,v 1.3 2003/09/06 23:03:06 grant Exp $        */
+/*     $NetBSD: strtoll.c,v 1.4 2003/12/19 22:40:04 grant Exp $        */
+/*     from NetBSD: strtoll.c,v 1.6 2003/10/27 00:12:42 lukem Exp      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -32,16 +33,18 @@
 #include "nbcompat.h"
 
 /*
- * Convert a string to a quad integer.
+ * Convert a string to a long long integer.
  *
  * Ignores `locale' stuff.  Assumes that the upper and lower case
  * alphabets and digits are each contiguous.
  */
-long long
+/* LONGLONG */
+long long int
 strtoll(const char *nptr, char **endptr, int base)
 {
        const char *s;
-       long long acc, cutoff;
+       /* LONGLONG */
+       long long int acc, cutoff;
        int c;
        int neg, any, cutlim;
 
@@ -85,7 +88,7 @@
         * followed by a legal input character, is too big.  One that
         * is equal to this value may be valid or not; the limit
         * between valid and invalid numbers is then based on the last
-        * digit.  For instance, if the range for quads is
+        * digit.  For instance, if the range for long longs is
         * [-9223372036854775808..9223372036854775807] and the input base
         * is 10, cutoff will be set to 922337203685477580 and cutlim to
         * either 7 (neg==0) or 8 (neg==1), meaning that if we have
@@ -96,7 +99,7 @@
         * Set any if any `digits' consumed; make it negative to indicate
         * overflow.
         */
-       cutoff = neg ? QUAD_MIN : QUAD_MAX;
+       cutoff = neg ? LLONG_MIN : LLONG_MAX;
        cutlim = (int)(cutoff % base);
        cutoff /= base;
        if (neg) {
@@ -120,7 +123,7 @@
                if (neg) {
                        if (acc < cutoff || (acc == cutoff && c > cutlim)) {
                                any = -1;
-                               acc = QUAD_MIN;
+                               acc = LLONG_MIN;
                                errno = ERANGE;
                        } else {
                                any = 1;
@@ -130,7 +133,7 @@
                } else {
                        if (acc > cutoff || (acc == cutoff && c > cutlim)) {
                                any = -1;
-                               acc = QUAD_MAX;
+                               acc = LLONG_MAX;
                                errno = ERANGE;
                        } else {
                                any = 1;



Home | Main Index | Thread Index | Old Index