[asterisk-commits] twilson: branch 1.8 r341529 - /branches/1.8/include/asterisk/strings.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 20 10:11:48 CDT 2011


Author: twilson
Date: Thu Oct 20 10:11:44 2011
New Revision: 341529

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=341529
Log:
Clean up ast_check_digits

The code was originally copied from the is_int() function in the AEL
code. wdoekes pointed out that the function should take a const char*
and that their was an unneeded variable. This is now fixed.

Modified:
    branches/1.8/include/asterisk/strings.h

Modified: branches/1.8/include/asterisk/strings.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/include/asterisk/strings.h?view=diff&rev=341529&r1=341528&r2=341529
==============================================================================
--- branches/1.8/include/asterisk/strings.h (original)
+++ branches/1.8/include/asterisk/strings.h Thu Oct 20 10:11:44 2011
@@ -878,13 +878,13 @@
  * \retval 0 The string contains non-digit characters
  */
 AST_INLINE_API(
-int ast_check_digits(char *arg),
-{
-	char *s;
-	for (s=arg; *s; s++) {
-		if (*s < '0' || *s > '9') {
+int ast_check_digits(const char *arg),
+{
+	while (*arg) {
+		if (*arg < '0' || *arg > '9') {
 			return 0;
 		}
+		arg++;
 	}
 	return 1;
 }




More information about the asterisk-commits mailing list