[asterisk-commits] wdoekes: branch 11 r379548 - in /branches/11: ./ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jan 19 14:49:48 CST 2013


Author: wdoekes
Date: Sat Jan 19 14:49:43 2013
New Revision: 379548

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379548
Log:
Add builtin roundf() for systems lacking it.

(closes issue ASTERISK-16854)
Review: https://reviewboard.asterisk.org/r/2276
Reported-by: Ovidiu Sas
........

Merged revisions 379547 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/11/   (props changed)
    branches/11/configure
    branches/11/configure.ac
    branches/11/include/asterisk/autoconfig.h.in
    branches/11/include/asterisk/compat.h
    branches/11/main/strcompat.c

Propchange: branches/11/
------------------------------------------------------------------------------
--- branch-1.8-merged (original)
+++ branch-1.8-merged Sat Jan 19 14:49:43 2013
@@ -1,1 +1,1 @@
-/branches/1.8:1-378147,378164,378356,378375,378427,378455-378456,378486,378514,378554,378591,378733,378776,378933,378967,379001,379145,379178,379226,379276,379310,379342,379392
+/branches/1.8:1-378147,378164,378356,378375,378427,378455-378456,378486,378514,378554,378591,378733,378776,378933,378967,379001,379145,379178,379226,379276,379310,379342,379392,379547

Modified: branches/11/configure.ac
URL: http://svnview.digium.com/svn/asterisk/branches/11/configure.ac?view=diff&rev=379548&r1=379547&r2=379548
==============================================================================
--- branches/11/configure.ac (original)
+++ branches/11/configure.ac Sat Jan 19 14:49:43 2013
@@ -590,7 +590,7 @@
 # so that AC_CHECK_FUNCS can detect functions in that library.
 AC_CHECK_LIB([m], [sqrt])
 # BSD might not have exp2, and/or log2
-AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round trunc floor ceil])
+AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round roundf trunc floor ceil])
 
 # Certain architectures don't really have long double, even though
 # AC_CHECK_FUNCS would otherwise find the following functions.

Modified: branches/11/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/branches/11/include/asterisk/autoconfig.h.in?view=diff&rev=379548&r1=379547&r2=379548
==============================================================================
--- branches/11/include/asterisk/autoconfig.h.in (original)
+++ branches/11/include/asterisk/autoconfig.h.in Sat Jan 19 14:49:43 2013
@@ -701,6 +701,9 @@
 
 /* Define to 1 if you have the `round' function. */
 #undef HAVE_ROUND
+
+/* Define to 1 if you have the `roundf' function. */
+#undef HAVE_ROUNDF
 
 /* Define to 1 if you have the `roundl' function. */
 #undef HAVE_ROUNDL

Modified: branches/11/include/asterisk/compat.h
URL: http://svnview.digium.com/svn/asterisk/branches/11/include/asterisk/compat.h?view=diff&rev=379548&r1=379547&r2=379548
==============================================================================
--- branches/11/include/asterisk/compat.h (original)
+++ branches/11/include/asterisk/compat.h Sat Jan 19 14:49:43 2013
@@ -216,4 +216,12 @@
 #define MY_GLOB_FLAGS   (GLOB_NOMAGIC | GLOB_BRACE)
 #endif
 
-#endif
+#ifndef HAVE_ROUNDF
+#ifdef HAVE_ROUND
+#define roundf(x) ((float)round(x))
+#else
+float roundf(float x);
+#endif
+#endif
+
+#endif

Modified: branches/11/main/strcompat.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/strcompat.c?view=diff&rev=379548&r1=379547&r2=379548
==============================================================================
--- branches/11/main/strcompat.c (original)
+++ branches/11/main/strcompat.c Sat Jan 19 14:49:43 2013
@@ -17,6 +17,8 @@
 /*! \file
  *
  * \brief Compatibility functions for strsep and strtoq missing on Solaris
+ *
+ * .. and lots of other functions too.
  */
 
 /*** MODULEINFO
@@ -568,3 +570,15 @@
 	return mktemp_internal(path, 0, MKTEMP_DIR) ? NULL : path;
 }
 #endif
+
+#ifndef HAVE_ROUNDF
+#ifndef HAVE_ROUND
+float roundf(float x) {
+	if (x < 0.0) {
+		return (float)(int)((x) - 0.5);
+	} else {
+		return (float)(int)((x) + 0.5);
+	}
+}
+#endif
+#endif




More information about the asterisk-commits mailing list