Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha/alpha Make atoi() use strtoll from libkern.
details: https://anonhg.NetBSD.org/src/rev/7e954286f41a
branches: trunk
changeset: 767690:7e954286f41a
user: njoly <njoly%NetBSD.org@localhost>
date: Wed Jul 27 15:08:42 2011 +0000
description:
Make atoi() use strtoll from libkern.
diffstat:
sys/arch/alpha/alpha/autoconf.c | 28 +++++-----------------------
1 files changed, 5 insertions(+), 23 deletions(-)
diffs (58 lines):
diff -r 5c2003cf83b2 -r 7e954286f41a sys/arch/alpha/alpha/autoconf.c
--- a/sys/arch/alpha/alpha/autoconf.c Wed Jul 27 14:35:33 2011 +0000
+++ b/sys/arch/alpha/alpha/autoconf.c Wed Jul 27 15:08:42 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.49 2011/07/26 14:59:03 njoly Exp $ */
+/* $NetBSD: autoconf.c,v 1.50 2011/07/27 15:08:42 njoly Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.49 2011/07/26 14:59:03 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.50 2011/07/27 15:08:42 njoly Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -63,7 +63,7 @@
struct bootdev_data *bootdev_data;
void parse_prom_bootdev(void);
-static int atoi(const char *);
+static inline int atoi(const char *);
/*
* cpu_configure:
@@ -163,28 +163,10 @@
bootdev_data = &bd;
}
-static int
+static inline int
atoi(const char *s)
{
- int n, neg;
-
- n = 0;
- neg = 0;
-
- while (*s == '-') {
- s++;
- neg = !neg;
- }
-
- while (*s != '\0') {
- if (*s < '0' && *s > '9')
- break;
-
- n = (10 * n) + (*s - '0');
- s++;
- }
-
- return (neg ? -n : n);
+ return (int)strtoll(s, NULL, 10);
}
void
Home |
Main Index |
Thread Index |
Old Index