From ebf806fd5265a431f395454d182e50cd5875ed12 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Tue, 1 Feb 2011 05:45:33 +0000 Subject: 2011-02-01 Ralf Corsepius * libmisc/stringto/stringto.h: Rename header-guard. Add rtems_string_to_long_double. --- cpukit/ChangeLog | 2 ++ cpukit/libmisc/stringto/stringto.h | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'cpukit') diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 3a5dc3435c..00a2ab255c 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,7 @@ 2011-02-01 Ralf Corsepius + * libmisc/stringto/stringto.h: Rename header-guard. + Add rtems_string_to_long_double. * libmisc/stringto/stringtoint.c: Reformat range check. Add check for result==0. * libmisc/stringto/stringtofloat.c: Reformat range check. diff --git a/cpukit/libmisc/stringto/stringto.h b/cpukit/libmisc/stringto/stringto.h index af2fd2f083..dfb1617bc9 100644 --- a/cpukit/libmisc/stringto/stringto.h +++ b/cpukit/libmisc/stringto/stringto.h @@ -9,8 +9,8 @@ * $Id$ */ -#ifndef __STRING_TO_A_TYPE_h__ -#define __STRING_TO_A_TYPE_h__ +#ifndef _RTEMS_STRINGTO_H +#define _RTEMS_STRINGTO_H #include @@ -224,4 +224,23 @@ rtems_status_code rtems_string_to_double( char **endptr ); +/** + * @brief Convert String to long double (with validation) + * + * This method converts a string to a long double with range validation. + * + * @param[in] s is the string to convert + * @param[in] n points to the variable to place the converted output in + * @param[in] endptr is used to keep track of the position in the string + * + * @return This method returns RTEMS_SUCCESSFUL on successful conversion + * and *n is filled in. Otherwise, the status indicates the + * source of the error. + */ +rtems_status_code rtems_string_to_long_double( + const char *s, + long double *n, + char **endptr +); + #endif -- cgit v1.2.3