Loading...
--- xnu/xnu-2422.100.13/iokit/Kernel/IOStringFuncs.c
+++ xnu/xnu-1228/iokit/Kernel/IOStringFuncs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 1998-2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -25,9 +25,7 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
-
-/*
- * Copyright (c) 1995 NeXT Computer, Inc. All rights reserved.
+/* Copyright (c) 1995 NeXT Computer, Inc. All rights reserved.
*
* strol.c - The functions strtol() & strtoul() are exported as public API
* via the header file ~driverkit/generalFuncs.h
@@ -40,7 +38,7 @@
* Commented out references to errno.
*/
-/*
+/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -81,15 +79,6 @@
#include <sys/types.h>
#include <machine/limits.h>
-
-long strtol(const char *nptr, char **endptr, int base);
-unsigned long strtoul(const char *nptr, char **endptr, int base);
-quad_t strtoq(const char *nptr, char **endptr, int base);
-u_quad_t strtouq(const char *nptr, char **endptr, int base);
-char *strchr(const char *str, int ch);
-char *strncat(char *s1, const char *s2, unsigned long n);
-
-
typedef int BOOL;
static inline BOOL
@@ -202,16 +191,7 @@
} else if (neg)
acc = -acc;
if (endptr != 0)
- {
- if(any)
- {
- *endptr = __CAST_AWAY_QUALIFIER(s - 1, const, char *);
- }
- else
- {
- *endptr = __CAST_AWAY_QUALIFIER(nptr, const, char *);
- }
- }
+ *endptr = (char *)(any ? s - 1 : nptr);
return (acc);
}
@@ -273,17 +253,7 @@
} else if (neg)
acc = -acc;
if (endptr != 0)
- {
- if(any)
- {
- *endptr = __CAST_AWAY_QUALIFIER(s - 1, const, char *);
- }
- else
- {
- *endptr = __CAST_AWAY_QUALIFIER(nptr, const, char *);
- }
- }
-
+ *endptr = (char *)(any ? s - 1 : nptr);
return (acc);
}
@@ -359,7 +329,7 @@
break;
if (c >= base)
break;
- if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+ if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
any = -1;
else {
any = 1;
@@ -373,17 +343,7 @@
} else if (neg)
acc = -acc;
if (endptr != 0)
- {
- if(any)
- {
- *endptr = __CAST_AWAY_QUALIFIER(s - 1, const, char *);
- }
- else
- {
- *endptr = __CAST_AWAY_QUALIFIER(nptr, const, char *);
- }
- }
-
+ *endptr = (char *)(any ? s - 1 : nptr);
return (acc);
}
@@ -440,7 +400,7 @@
break;
if (c >= base)
break;
- if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+ if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
any = -1;
else {
any = 1;
@@ -454,17 +414,7 @@
} else if (neg)
acc = -acc;
if (endptr != 0)
- {
- if(any)
- {
- *endptr = __CAST_AWAY_QUALIFIER(s - 1, const, char *);
- }
- else
- {
- *endptr = __CAST_AWAY_QUALIFIER(nptr, const, char *);
- }
- }
-
+ *endptr = (char *)(any ? s - 1 : nptr);
return (acc);
}
@@ -477,7 +427,7 @@
{
do {
if (*str == ch)
- return(__CAST_AWAY_QUALIFIER(str, const, char *));
+ return((char *)str);
} while (*str++);
return ((char *) 0);
}