From: Terry Wilson Date: Thu, 20 Oct 2011 15:17:53 +0000 (+0000) Subject: Clean up ast_check_digits X-Git-Tag: 11.0.0-beta1~1014 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f1130e13f48765b4fc8080bf2e1018a0a989344;p=thirdparty%2Fasterisk.git 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. ........ Merged revisions 341529 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 341530 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@341533 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index cd69c6b6b9..2a8b0e4905 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -878,13 +878,13 @@ int __attribute__((format(printf, 3, 4))) ast_str_append( * \retval 0 The string contains non-digit characters */ AST_INLINE_API( -int ast_check_digits(char *arg), +int ast_check_digits(const char *arg), { - char *s; - for (s=arg; *s; s++) { - if (*s < '0' || *s > '9') { + while (*arg) { + if (*arg < '0' || *arg > '9') { return 0; } + arg++; } return 1; }