[asterisk-commits] tilghman: trunk r232164 - in /trunk: ./ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 1 21:26:20 CST 2009


Author: tilghman
Date: Tue Dec  1 21:26:16 2009
New Revision: 232164

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=232164
Log:
So apparently, some platforms don't have ffsll(3).
The manpage lies; it says that the function is in POSIX, but that's only for
ffs(3), not ffsll(3).

Modified:
    trunk/configure
    trunk/configure.ac
    trunk/include/asterisk/autoconfig.h.in
    trunk/include/asterisk/compat.h
    trunk/main/strcompat.c

Modified: trunk/configure.ac
URL: http://svnview.digium.com/svn/asterisk/trunk/configure.ac?view=diff&rev=232164&r1=232163&r2=232164
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Tue Dec  1 21:26:16 2009
@@ -390,7 +390,7 @@
 AC_FUNC_STRTOD
 AC_FUNC_UTIME_NULL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
+AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
 
 # NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
 # so that AC_CHECK_FUNCS can detect functions in that library.

Modified: trunk/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/autoconfig.h.in?view=diff&rev=232164&r1=232163&r2=232164
==============================================================================
--- trunk/include/asterisk/autoconfig.h.in (original)
+++ trunk/include/asterisk/autoconfig.h.in Tue Dec  1 21:26:16 2009
@@ -231,6 +231,9 @@
 
 /* Define to the version of the Ffmpeg and avcodec library library. */
 #undef HAVE_FFMPEG_VERSION
+
+/* Define to 1 if you have the `ffsll' function. */
+#undef HAVE_FFSLL
 
 /* Define to 1 if you have the `floor' function. */
 #undef HAVE_FLOOR

Modified: trunk/include/asterisk/compat.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/compat.h?view=diff&rev=232164&r1=232163&r2=232164
==============================================================================
--- trunk/include/asterisk/compat.h (original)
+++ trunk/include/asterisk/compat.h Tue Dec  1 21:26:16 2009
@@ -77,6 +77,10 @@
 int __attribute__((format(printf, 2, 3))) asprintf(char **str, const char *fmt, ...);
 #endif
 
+#ifndef HAVE_FFSLL
+int ffsll(long long n);
+#endif
+
 #ifndef HAVE_GETLOADAVG
 int getloadavg(double *list, int nelem);
 #endif

Modified: trunk/main/strcompat.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/strcompat.c?view=diff&rev=232164&r1=232163&r2=232164
==============================================================================
--- trunk/main/strcompat.c (original)
+++ trunk/main/strcompat.c Tue Dec  1 21:26:16 2009
@@ -386,3 +386,16 @@
 }
 #endif
 
+#ifndef HAVE_FFSLL
+int ffsll(long long n)
+{
+	int i;
+	for (i = 0; i < 64; i++) {
+		if ((1LL << i) & n) {
+			return i + 1;
+		}
+	}
+	return 0;
+}
+#endif
+




More information about the asterisk-commits mailing list