diff options
author | Qihao Chencao <twose@qq.com> | 2022-06-28 16:57:55 +0800 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-02-17 17:07:44 -0300 |
commit | cc4d6614b5922c1104125b1f4d0850a88a551882 (patch) | |
tree | aade315fd79153cf930e8dfd15581dcbdffea0b8 /stdlib | |
parent | dab63442791e334d592ce91827ffa9d14ca92ea9 (diff) | |
download | glibc-cc4d6614b5922c1104125b1f4d0850a88a551882.zip glibc-cc4d6614b5922c1104125b1f4d0850a88a551882.tar.gz glibc-cc4d6614b5922c1104125b1f4d0850a88a551882.tar.bz2 |
Use uintptr_t instead of performing pointer subtraction with a null pointer
Signed-off-by: Qihao Chencao <twose@qq.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/msort.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/stdlib/msort.c b/stdlib/msort.c index 6dd1cc3..bbaa5e9 100644 --- a/stdlib/msort.c +++ b/stdlib/msort.c @@ -281,15 +281,15 @@ __qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp, void *arg) else { if ((s & (sizeof (uint32_t) - 1)) == 0 - && ((char *) b - (char *) 0) % __alignof__ (uint32_t) == 0) + && ((uintptr_t) b) % __alignof__ (uint32_t) == 0) { if (s == sizeof (uint32_t)) p.var = 0; else if (s == sizeof (uint64_t) - && ((char *) b - (char *) 0) % __alignof__ (uint64_t) == 0) + && ((uintptr_t) b) % __alignof__ (uint64_t) == 0) p.var = 1; else if ((s & (sizeof (unsigned long) - 1)) == 0 - && ((char *) b - (char *) 0) + && ((uintptr_t) b) % __alignof__ (unsigned long) == 0) p.var = 2; } |