diff options
author | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-17 00:30:11 +0000 |
---|---|---|
committer | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-17 00:30:11 +0000 |
commit | a3ec1e1f94edf547932e109b93b3ea9d443b1758 (patch) | |
tree | 7033ea5b44dc461a149d2f597d334358e97c6c4a /src | |
parent | 8b16068941819b951136b07b2e8e70adbe66fd65 (diff) | |
download | openocd+libswd-a3ec1e1f94edf547932e109b93b3ea9d443b1758.tar.gz openocd+libswd-a3ec1e1f94edf547932e109b93b3ea9d443b1758.tar.bz2 openocd+libswd-a3ec1e1f94edf547932e109b93b3ea9d443b1758.tar.xz openocd+libswd-a3ec1e1f94edf547932e109b93b3ea9d443b1758.zip |
Update parse_type macro definitions to allow re-use with signed types.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2254 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r-- | src/helper/command.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/helper/command.h b/src/helper/command.h index 293eb141..fb80d597 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -110,14 +110,17 @@ long jim_global_long(const char *variable); int parse_ulong(const char *str, unsigned long *ul); int parse_ullong(const char *str, unsigned long long *ul); -#define DEFINE_PARSE_ULONG(name, type, max) \ +#define DEFINE_PARSE_NUM_WRAP(name, type, max, functype, funcname) \ static inline int parse_##name(const char *str, type *ul) \ { \ - unsigned long n; \ - int retval = parse_ulong(str, &n); \ + functype n; \ + int retval = parse##funcname(str, &n); \ *ul = n; \ return n > (max) ? ERROR_COMMAND_SYNTAX_ERROR : retval; \ } + +#define DEFINE_PARSE_ULONG(name, type, max) \ + DEFINE_PARSE_NUM_WRAP(name, type, max, unsigned long, _ulong) DEFINE_PARSE_ULONG(uint, unsigned, UINT_MAX) DEFINE_PARSE_ULONG(u32, uint32_t, UINT32_MAX) DEFINE_PARSE_ULONG(u16, uint16_t, UINT16_MAX) |