comparison th_string.h @ 617:a3d5ddbb6f16

Add some extra () protection in the th_is* macro wrapper arguments.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 17 Jan 2020 03:21:05 +0200
parents 594f197f7005
children 64fd686197d4
comparison
equal deleted inserted replaced
616:594f197f7005 617:a3d5ddbb6f16
17 17
18 #ifdef __cplusplus 18 #ifdef __cplusplus
19 extern "C" { 19 extern "C" {
20 #endif 20 #endif
21 21
22
22 /** @def String utility wrapper macros 23 /** @def String utility wrapper macros
23 */ 24 */
24 #define th_isalnum(c) isalnum((int)(unsigned char) c) 25 #define th_isalnum(c) isalnum((int)(unsigned char) (c))
25 #define th_isalpha(c) isalpha((int)(unsigned char) c) 26 #define th_isalpha(c) isalpha((int)(unsigned char) (c))
26 #define th_isascii(c) isascii((int)(unsigned char) c) 27 #define th_isascii(c) isascii((int)(unsigned char) (c))
27 #define th_isblank(c) isblank((int)(unsigned char) c) 28 #define th_isblank(c) isblank((int)(unsigned char) (c))
28 #define th_iscntrl(c) iscntrl((int)(unsigned char) c) 29 #define th_iscntrl(c) iscntrl((int)(unsigned char) (c))
29 #define th_isdigit(c) isdigit((int)(unsigned char) c) 30 #define th_isdigit(c) isdigit((int)(unsigned char) (c))
30 #define th_isgraph(c) isgraph((int)(unsigned char) c) 31 #define th_isgraph(c) isgraph((int)(unsigned char) (c))
31 #define th_islower(c) islower((int)(unsigned char) c) 32 #define th_islower(c) islower((int)(unsigned char) (c))
32 #define th_isprint(c) isprint((int)(unsigned char) c) 33 #define th_isprint(c) isprint((int)(unsigned char) (c))
33 #define th_ispunct(c) ispunct((int)(unsigned char) c) 34 #define th_ispunct(c) ispunct((int)(unsigned char) (c))
34 #define th_isspace(c) isspace((int)(unsigned char) c) 35 #define th_isspace(c) isspace((int)(unsigned char) (c))
35 #define th_isupper(c) isupper((int)(unsigned char) c) 36 #define th_isupper(c) isupper((int)(unsigned char) (c))
36 #define th_isxdigit(c) isxdigit((int)(unsigned char) c) 37 #define th_isxdigit(c) isxdigit((int)(unsigned char) (c))
37 #define th_iscrlf(c) ((c=='\r')||(c=='\n')) 38 #define th_iscrlf(c) ((c) == '\r' || (c) == '\n')
38 39
39 #define th_isspecial(q) (((q >= 0x5b) && (q <= 0x60)) || ((q >= 0x7b) && (q <= 0x7d))) 40 #define th_isspecial(q) ((q) >= 0x5b && (q) <= 0x60 || (q) >= 0x7b && (q) <= 0x7d)
40 41
41 #define th_tolower(c) tolower((int)(unsigned char) c) 42 #define th_tolower(c) tolower((int)(unsigned char) (c))
42 #define th_toupper(c) toupper((int)(unsigned char) c) 43 #define th_toupper(c) toupper((int)(unsigned char) (c))
43 44
44 45
45 /** @brief 46 /** @brief
46 * String trimming option flags for th_strdup_trim() 47 * String trimming option flags for th_strdup_trim()
47 */ 48 */