zpmod
b19981f
High-performance Zsh module for script optimization and filesystem helpers
|
#include "zpmod.mdh"
Go to the source code of this file.
Macros | |
#define | ZPMOD_FPATH_H |
Functions | |
int | cmd_fpath_index (char *nam, char **argv) |
Implements zpmod fpath-index with intelligent skip detection. More... | |
#define ZPMOD_FPATH_H |
Definition at line 3 of file zpmod_fpath.h.
int cmd_fpath_index | ( | char * | nam, |
char ** | argv | ||
) |
Implements zpmod fpath-index
with intelligent skip detection.
Generates function-to-path mappings from FPATH directories with performance optimization through skip detection that avoids rebuilding unchanged indexes.
The generated index uses a structured format for reliable skip detection:
The skip detection was redesigned to handle missing directories consistently, fixing a critical issue where mtime mismatches caused unnecessary rebuilds.
Original Problem: When a directory didn't exist during index generation, we recorded -1
as the mtime. However, if the directory appeared later or stat() behaved differently during verification, we'd get a mismatch and force an unnecessary rebuild.
Solution: Unified mtime handling ensures consistent comparison:
stat()
failure → record -1
stat()
failure → use -1
for comparisonnam | Builtin name for error reporting |
argv | Command arguments (–out, –rebuild, –preload) |