forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitef0938f
committed
Invent "MatchAnyN" option for tab-complete.c's Matches/MatchesCS.
This argument matches any number (including zero) of previous words.Use it to replace the common coding patternif (HeadMatches("A", "B") && TailMatches("X", "Y"))withif (Matches("A", "B", MatchAnyN, "X", "Y"))In itself this feature doesn't do much except (arguably) make thecode slightly shorter and more readable. However, it reduces thenumber of complex if-condition patterns that have to be dealt within the next commits in this series.While here, restructure the *Matches implementation functions sothat the actual work is done in functions that take a char **array of pattern strings, and the versions taking variadic argumentsare thin wrappers around the array ones. This simplifies thenew Matches logic considerably. At the end of this patch series,the array functions will be the only ones that are material toperformance, so having the variadic ones be wrappers makes sense.Discussion:https://postgr.es/m/2208466.1720729502@sss.pgh.pa.us1 parent8275325 commitef0938f
1 file changed
+258
-142
lines changed0 commit comments
Comments
(0)