diff options
author | Terry Wilson <twilson@digium.com> | 2011-10-19 07:45:06 +0000 |
---|---|---|
committer | Terry Wilson <twilson@digium.com> | 2011-10-19 07:45:06 +0000 |
commit | 5f8648892feb256d7a44e81b34617585afcf6e2b (patch) | |
tree | 1cb722ba4e796e4d81e485b2026a82f553fb28f8 /include | |
parent | 2816ccc516af65e6d97f73a34e7e4f989dd7dd17 (diff) |
Don't use is_int() since it doesn't link well on all platforms
Just create an normal API function in strings.h that does the same thing
just to be safe.
ASTERISK-17146
........
Merged revisions 341379 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 341380 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@341381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/strings.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index 49d3e0da8..cd69c6b6b 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -872,6 +872,25 @@ int __attribute__((format(printf, 3, 4))) ast_str_append( ) /*! + * \brief Check if a string is only digits + * + * \retval 1 The string contains only digits + * \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') { + return 0; + } + } + return 1; +} +) + +/*! * \brief Compute a hash value on a string * * This famous hash algorithm was written by Dan Bernstein and is |