Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/stdlib Recognize 0[bB] as binary (base 2)
details: https://anonhg.NetBSD.org/src/rev/370e4a9bbec9
branches: trunk
changeset: 341585:370e4a9bbec9
user: christos <christos%NetBSD.org@localhost>
date: Thu Nov 12 17:23:51 2015 +0000
description:
Recognize 0[bB] as binary (base 2)
diffstat:
common/lib/libc/stdlib/_strtol.h | 10 +++++++---
common/lib/libc/stdlib/_strtoul.h | 10 +++++++---
2 files changed, 14 insertions(+), 6 deletions(-)
diffs (48 lines):
diff -r dab18e462a73 -r 370e4a9bbec9 common/lib/libc/stdlib/_strtol.h
--- a/common/lib/libc/stdlib/_strtol.h Thu Nov 12 16:51:18 2015 +0000
+++ b/common/lib/libc/stdlib/_strtol.h Thu Nov 12 17:23:51 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: _strtol.h,v 1.7 2013/05/17 12:55:56 joerg Exp $ */
+/* $NetBSD: _strtol.h,v 1.8 2015/11/12 17:23:51 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -105,8 +105,12 @@
c = s[1];
s += 2;
base = 16;
- }
- if (base == 0)
+ } else if ((base == 0 || base == 2) &&
+ c == '0' && (*s == 'b' || *s == 'b')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ } else if (base == 0)
base = (c == '0' ? 8 : 10);
/*
diff -r dab18e462a73 -r 370e4a9bbec9 common/lib/libc/stdlib/_strtoul.h
--- a/common/lib/libc/stdlib/_strtoul.h Thu Nov 12 16:51:18 2015 +0000
+++ b/common/lib/libc/stdlib/_strtoul.h Thu Nov 12 17:23:51 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: _strtoul.h,v 1.7 2013/05/17 12:55:56 joerg Exp $ */
+/* $NetBSD: _strtoul.h,v 1.8 2015/11/12 17:23:51 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -102,8 +102,12 @@
c = s[1];
s += 2;
base = 16;
- }
- if (base == 0)
+ } else if ((base == 0 || base == 2) &&
+ c == '0' && (*s == 'b' || *s == 'B')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ } else if (base == 0)
base = (c == '0' ? 8 : 10);
/*
Home |
Main Index |
Thread Index |
Old Index