Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru> writes:
> How about rewriting such a code like this?
> if (pg_str_containsonly(str, " \t\n\r\f"))
Function name seems weirdly spelled. Also, I believe that in nearly all
use-cases the number of data characters that would typically be examined
is small, so I have serious doubts that the "optimized" implementation
you propose is actually faster than a naive one; it may be slower, and
it's certainly longer and harder to understand/test.
Whether it's worth worrying about, I dunno. This is hardly the only
C idiom you need to be familiar with to read the PG code.
regards, tom lane