diff options
author | David Shaw <[email protected]> | 2003-07-10 12:13:53 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2003-07-10 12:13:53 +0000 |
commit | d8a6bd3b841dc9f883f7afc5574d15c05f12b83a (patch) | |
tree | a93d59e1eb53729639fe9c653d95197c50f7b8e2 /include/util.h | |
parent | * THANKS: Updates from stable. (diff) | |
download | gnupg-d8a6bd3b841dc9f883f7afc5574d15c05f12b83a.tar.gz gnupg-d8a6bd3b841dc9f883f7afc5574d15c05f12b83a.zip |
* types.h: Prefer using uint64_t when creating a 64-bit unsigned type.
This avoids a warning on compilers that support but complain about
unsigned long long.
* util.h (ascii_isspace): New variation on isspace() that is immune from
locale changes.
* util.h: Make sure that only ascii is passed to isfoo functions. (From
Werner on stable branch).
Diffstat (limited to 'include/util.h')
-rw-r--r-- | include/util.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h index c3d0189c6..978b37eed 100644 --- a/include/util.h +++ b/include/util.h @@ -264,6 +264,16 @@ int vasprintf ( char **result, const char *format, va_list args); #define wipememory2(_ptr,_set,_len) do { volatile char *_vptr=(volatile char *)(_ptr); size_t _vlen=(_len); while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } } while(0) #define wipememory(_ptr,_len) wipememory2(_ptr,0,_len) +/*-- macros to replace ctype ones and avoid locale problems --*/ +#define spacep(p) (*(p) == ' ' || *(p) == '\t') +#define digitp(p) (*(p) >= '0' && *(p) <= '9') +#define hexdigitp(a) (digitp (a) \ + || (*(a) >= 'A' && *(a) <= 'F') \ + || (*(a) >= 'a' && *(a) <= 'f')) +/* Note this isn't identical to a C locale isspace() without \f and + \v, but works for the purposes used here. */ +#define ascii_isspace(a) ((a)==' ' || (a)=='\n' || (a)=='\r' || (a)=='\t') + /******* RISC OS stuff ***********/ #ifdef __riscos__ /* needed for strcasecmp() */ |