These two patches follow patch #199: Use constant tables for metadata tag lookup. Apply #199 to SVN trunk r1911 first, then apply the attached patches in order with patch -p1.
Patch 2/3 stores names and descriptions in a separate constant string pool for each metadata model. Descriptors hold 16-bit offsets, eliminating their string-pointer relocations. Each model's unused descriptors and strings can be discarded together. The table rows remain a readable list; C++98 sizeof/offsetof expressions generate the layout and a compile-time bound protects each pool. There is no generator, runtime pool initialization, heap allocation or mutable cache.
Patch 3/3 adds an internal getTagFields helper and uses it at the ten callers that need both name and description. This shares model dispatch and binary search. The original three-argument getTagFieldName symbol and getTagDescription remain available. Missing tags or descriptions clear the description output, and name fallback behavior is unchanged. The public FreeImage C API and returned string lifetimes are unchanged.
Each patch passes the standalone C++98 metadata regression with GCC and strict Clang ASan/UBSan/LeakSanitizer, checking 1,572,864 model/tag lookups plus pool bounds, decoded strings, sorted IDs, reverse names and fallbacks. The completed series also passes 1,638,400 baseline-equivalence model/tag checks with strict sanitizers, a full Linux build, and TestAPI. TestAPI uses the same existing tif_hash_set.c link workaround as #199.
The full series was applied without fuzz to a pristine SVN r1911 export, and the resulting files were compared with the committed source after each patch.
Anonymous