1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

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>
This commit is contained in:
Qihao Chencao
2022-06-28 16:57:55 +08:00
committed by Adhemerval Zanella
parent dab6344279
commit cc4d6614b5
12 changed files with 35 additions and 36 deletions

View File

@@ -23,6 +23,7 @@
argument to 'step' and 'advance' was defined only in regexp.h,
as its definition depended on macros defined by the user. */
#include <stdint.h>
#include <regex.h>
#include <shlib-compat.h>
@@ -50,7 +51,7 @@ step (const char *string, const char *expbuf)
regmatch_t match; /* We only need info about the full match. */
expbuf += __alignof (regex_t *);
expbuf -= (expbuf - ((const char *) 0)) % __alignof__ (regex_t *);
expbuf -= ((uintptr_t) expbuf) % __alignof__ (regex_t *);
if (__regexec ((const regex_t *) expbuf, string, 1, &match, REG_NOTEOL)
== REG_NOMATCH)
@@ -73,7 +74,7 @@ advance (const char *string, const char *expbuf)
regmatch_t match; /* We only need info about the full match. */
expbuf += __alignof__ (regex_t *);
expbuf -= (expbuf - ((const char *) 0)) % __alignof__ (regex_t *);
expbuf -= ((uintptr_t) expbuf) % __alignof__ (regex_t *);
if (__regexec ((const regex_t *) expbuf, string, 1, &match, REG_NOTEOL)
== REG_NOMATCH