summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2007-09-18 10:47:03 +0000
committerPierre Ossman <ossman@cendio.se>2007-09-18 10:47:03 +0000
commit4ed41f3dab352757513cb8f5c49485de4bec6d6d (patch)
tree2e0f9d6466696e114afeee341f0460d7aae4cfce
parentaff22cfc6276ad33f793081cf4e8bb09cec95aa6 (diff)
strtof() is a rather recent addition to C. Fall back to strtod() if it isn't
available. git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1853 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--configure.ac2
-rw-r--r--src/pulsecore/core-util.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 5250804b..d03774ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -267,7 +267,7 @@ AC_CHECK_FUNCS([getopt_long], [], [AC_CHECK_LIB([iberty], [getopt_long])])
#### Check for functions ####
# ISO
-AC_CHECK_FUNCS([lrintf])
+AC_CHECK_FUNCS([lrintf strtof])
# POSIX
AC_FUNC_FORK
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 6a0bd0ac..afd89bad 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -1300,7 +1300,11 @@ int pa_atof(const char *s, float *ret_f) {
#endif
{
errno = 0;
+#ifdef HAVE_STRTOF
f = strtof(s, &x);
+#else
+ f = strtod(s, &x);
+#endif
}
if (!x || *x || errno != 0)