diff options
author | Jim Meyering <meyering@fb.com> | 2014-01-30 13:03:26 -0800 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2014-02-01 08:48:13 -0800 |
commit | c5cb52ecb97af4bf052e1c1366b8eb93a54ba6a0 (patch) | |
tree | 18491b52be85f25dac1198b390ea38df624003e7 /src/system.h | |
parent | c28c90bc17b61e355bbad757e26a7027feb57fe1 (diff) | |
download | grep-c5cb52ecb97af4bf052e1c1366b8eb93a54ba6a0.tar.gz |
maint: use to_uchar function rather than explicit casts
* src/system.h (to_uchar): Define function.
* src/kwsearch.c (Fexecute): Use to_uchar twice in place of casts.
* src/dfasearch.c (EGexecute): Likewise.
* src/main.c (prepend_args): Likewise.
* src/kwset.c (U): Define in terms of to_uchar.
* src/dfa.c (match_mb_charset): Use to_uchar, not an explicit cast.
Diffstat (limited to 'src/system.h')
-rw-r--r-- | src/system.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/system.h b/src/system.h index b07471b3..4c854096 100644 --- a/src/system.h +++ b/src/system.h @@ -55,4 +55,13 @@ enum { EXIT_TROUBLE = 2 }; #define STREQ(a, b) (strcmp (a, b) == 0) +/* Convert a possibly-signed character to an unsigned character. This is + a bit safer than casting to unsigned char, since it catches some type + errors that the cast doesn't. */ +static inline unsigned char +to_uchar (char ch) +{ + return ch; +} + #endif |