summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-06-14 16:36:46 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-08-09 02:30:13 -0700
commitdadc9f49c08c98910ccd208e6fea573304aa8ca2 (patch)
tree27cb3fdee84c1d93678067c8dd62216c63ed8398
parent5c628c7074ae4a90a62165502afe5e7cb6a7eaa5 (diff)
downloadgrep-dadc9f49c08c98910ccd208e6fea573304aa8ca2.tar.gz
grep: pointer-integer cast nit
* src/grep.c (ALIGN_TO): When converting pointers to unsigned integers, convert to uintptr_t not size_t, as size_t in theory might be too narrow.
-rw-r--r--src/grep.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/grep.c b/src/grep.c
index 100acfb8..f86bce55 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -880,9 +880,9 @@ enum { INITIAL_BUFSIZE = 96 * 1024 };
/* Return VAL aligned to the next multiple of ALIGNMENT. VAL can be
an integer or a pointer. Both args must be free of side effects. */
#define ALIGN_TO(val, alignment) \
- ((size_t) (val) % (alignment) == 0 \
+ ((uintptr_t) (val) % (alignment) == 0 \
? (val) \
- : (val) + ((alignment) - (size_t) (val) % (alignment)))
+ : (val) + ((alignment) - (uintptr_t) (val) % (alignment)))
/* Add two numbers that count input bytes or lines, and report an
error if the addition overflows. */