By default, the code generated by gperf
operates on zero
terminated strings, the usual representation of strings in C. This means
that the keywords in the input file must not contain NUL bytes,
and the str argument passed to hash
or in_word_set
must be NUL terminated and have exactly length len.
If option ‘-c’ (or, equivalently, the ‘%compare-strncmp’
declaration) is used, then the str argument does not need
to be NUL terminated. The code generated by gperf
will only
access the first len, not len+1, bytes starting at str.
However, the keywords in the input file still must not contain NUL
bytes.
If option ‘-l’ (or, equivalently, the ‘%compare-lengths’
declaration) is used, then the hash table performs binary
comparison. The keywords in the input file may contain NUL bytes,
written in string syntax as \000
or \x00
, and the code
generated by gperf
will treat NUL like any other byte.
Also, in this case the ‘-c’ option (or, equivalently, the
‘%compare-strncmp’ declaration) is ignored.