Skip to content

Commit bef896e

Browse files
committed
Merge branch 'rs/no-null-ptr-arith-in-fast-export'
Code clean-up to avoid non-standard-conformant pointer arithmetic. * rs/no-null-ptr-arith-in-fast-export: fast-export: avoid NULL pointer arithmetic
2 parents 0abb962 + c112084 commit bef896e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

builtin/fast-export.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,14 @@ static void anonymize_path(struct strbuf *out, const char *path,
156156
}
157157
}
158158

159-
/* Since intptr_t is C99, we do not use it here */
160-
static inline uint32_t *mark_to_ptr(uint32_t mark)
159+
static inline void *mark_to_ptr(uint32_t mark)
161160
{
162-
return ((uint32_t *)NULL) + mark;
161+
return (void *)(uintptr_t)mark;
163162
}
164163

165164
static inline uint32_t ptr_to_mark(void * mark)
166165
{
167-
return (uint32_t *)mark - (uint32_t *)NULL;
166+
return (uint32_t)(uintptr_t)mark;
168167
}
169168

170169
static inline void mark_object(struct object *object, uint32_t mark)

0 commit comments

Comments
 (0)