Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'rs/no-null-ptr-arith-in-fast-export'
author
Junio C Hamano
<gitster@pobox.com>
Wed, 30 May 2018 05:04:06 +0000
(14:04 +0900)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 30 May 2018 05:04:06 +0000
(14:04 +0900)
Code clean-up to avoid non-standard-conformant pointer arithmetic.
* rs/no-null-ptr-arith-in-fast-export:
fast-export: avoid NULL pointer arithmetic
builtin/fast-export.c
patch
|
blob
|
history
raw
(from parent 1:
0abb962
)
diff --git
a/builtin/fast-export.c
b/builtin/fast-export.c
index 68a762fbeaa1363d6b0d709f1500b1925796a711..07d20f446fa7c4a7c62be5e6ef44a7bd06e5d5a9 100644
(file)
--- a/
builtin/fast-export.c
+++ b/
builtin/fast-export.c
@@
-156,15
+156,14
@@
static void anonymize_path(struct strbuf *out, const char *path,
}
}
-/* Since intptr_t is C99, we do not use it here */
-static inline uint32_t *mark_to_ptr(uint32_t mark)
+static inline void *mark_to_ptr(uint32_t mark)
{
- return (
(uint32_t *)NULL) +
mark;
+ return (
void *)(uintptr_t)
mark;
}
static inline uint32_t ptr_to_mark(void * mark)
{
- return (uint32_t
*)mark - (uint32_t *)NULL
;
+ return (uint32_t
)(uintptr_t)mark
;
}
static inline void mark_object(struct object *object, uint32_t mark)