refactor(platform): Unify watch logic and fix manual snapshot leaks
Unlike inotify, Windows and BSD require manual state snapshots to detect specific file changes. This refactor standardizes that manual handling to ensure it is resource-safe and easy to follow. - Fix memory leaks in platform_directory_watch_check where temporary buffers (new_snaps, file_list) were not reliably freed on 'phantom' triggers or error paths. - Unify control flow using a 'goto' cleanup pattern to ensure deterministic resource deallocation. - Synchronizes the manual snapshot comparison logic between Windows and BSD to ensure identical LOAD/RELOAD/UNLOAD event behavior. - Simplifies the platform_directory_init_scan logic by removing redundant directory rewinds and nested checks. - Add WIN32_LEAN_AND_MEAN to optimize Windows header inclusion. - Align internal API signatures (is_module_loaded) for consistency.
This commit is contained in:
+522
-584
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user