From 0f6ef690b3118882121ed67561c7ce2660cfebe1 Mon Sep 17 00:00:00 2001 From: theraven Date: Sun, 20 Nov 2011 14:45:42 +0000 Subject: Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a load of _l suffixed versions of various standard library functions that use the global locale, making them take an explicit locale parameter. Also adds support for per-thread locales. This work was funded by the FreeBSD Foundation. Please test any code you have that uses the C standard locale functions! Reviewed by: das (gdtoa changes) Approved by: dim (mentor) --- lib/libc/stdlib/atoi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/libc/stdlib/atoi.c') diff --git a/lib/libc/stdlib/atoi.c b/lib/libc/stdlib/atoi.c index 0ffcd03..31a8676 100644 --- a/lib/libc/stdlib/atoi.c +++ b/lib/libc/stdlib/atoi.c @@ -2,6 +2,11 @@ * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * + * Copyright (c) 2011 The FreeBSD Foundation + * All rights reserved. + * Portions of this software were developed by David Chisnall + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,6 +39,7 @@ static char sccsid[] = "@(#)atoi.c 8.1 (Berkeley) 6/4/93"; __FBSDID("$FreeBSD$"); #include +#include int atoi(str) @@ -41,3 +47,11 @@ atoi(str) { return (int)strtol(str, (char **)NULL, 10); } + +int +atoi_l(str, locale) + const char *str; + locale_t locale; +{ + return (int)strtol_l(str, (char **)NULL, 10, locale); +} -- cgit v1.1