1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +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

@@ -281,7 +281,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
/* Adjust the pointer so it is aligned for
storing pointers. */
first_unused += __alignof__ (char *) - 1;
first_unused -= ((first_unused - (char *) 0)
first_unused -= (((uintptr_t) first_unused)
% __alignof__ (char *));
result->alias_members = (char **) first_unused;

View File

@@ -239,7 +239,7 @@ parse_list (char **linep, char *eol, char *buf_end, int terminator_c,
/* Adjust the pointer so it is aligned for storing pointers. */
eol += __alignof__ (char *) - 1;
eol -= (eol - (char *) 0) % __alignof__ (char *);
eol -= ((uintptr_t) eol) % __alignof__ (char *);
/* We will start the storage here for the vector of pointers. */
list = (char **) eol;