diff options
| author | 2026-01-14 02:50:40 +0100 | |
|---|---|---|
| committer | 2026-01-14 02:50:40 +0100 | |
| commit | 5b3ae4c1326e0c85df906ffea49b97b80b13ceae (patch) | |
| tree | a6efdca6333188abf924e13cb70a7aae49665ae1 /src/plist.h | |
| parent | 25d61ff8b5d994a02c0cc2af8e029bebd3a94cb3 (diff) | |
| download | libplist-5b3ae4c1326e0c85df906ffea49b97b80b13ceae.tar.gz libplist-5b3ae4c1326e0c85df906ffea49b97b80b13ceae.tar.bz2 | |
Add circular reference detection to all format writers
Thanks to @LkkkLxy for pointing out the issue.
Diffstat (limited to 'src/plist.h')
| -rw-r--r-- | src/plist.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plist.h b/src/plist.h index a993e3a..3043fb7 100644 --- a/src/plist.h +++ b/src/plist.h @@ -81,4 +81,17 @@ extern plist_err_t plist_write_to_stream_default(plist_t plist, FILE *stream, pl extern plist_err_t plist_write_to_stream_limd(plist_t plist, FILE *stream, plist_write_options_t options); extern plist_err_t plist_write_to_stream_plutil(plist_t plist, FILE *stream, plist_write_options_t options); +static inline unsigned int plist_node_ptr_hash(const void *ptr) +{ + uintptr_t h = (uintptr_t)ptr; + h ^= (h >> 16); + h *= 0x85ebca6b; + return (unsigned int)h; +} + +static inline int plist_node_ptr_compare(const void *a, const void *b) +{ + return a == b; +} + #endif |
