|
zpmod
b19981f
High-performance Zsh module for script optimization and filesystem helpers
|
FPATH indexing for autoload. More...
#include "zpmod.mdh"#include "zpmod.pro"#include "zpmod_fpath.h"#include "zpmod_vendor_shims.h"#include <dirent.h>#include <stdio.h>#include <string.h>#include <sys/stat.h>Go to the source code of this file.
Functions | |
| int | cmd_fpath_index (char *nam, char **argv) |
Implements zpmod fpath-index with intelligent skip detection. More... | |
FPATH indexing for autoload.
Definition in file fpath.c.
| 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 -1stat() failure → use -1 for comparison| nam | Builtin name for error reporting |
| argv | Command arguments (–out, –rebuild, –preload) |
Definition at line 57 of file fpath.c.
References addhashnode(), dupstring(), getaparam(), gethashnode2(), shfunctab, zalloc(), ztrdup(), and zwarnnam().
Referenced by bin_zpmod().