bug-gperf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gperf] gperf lacks support for binary keys.


From: Carlo Wood
Subject: [bug-gperf] gperf lacks support for binary keys.
Date: Sun, 19 Jan 2014 19:11:34 +0100

Greetings,

although there seemingly is support for binary keys,
through the command line option --compare-lengths
which states "Compare key lengths before trying a
string comparison. This is necessary if the
keywords contain NUL bytes", there is no provision
for really binary input, and without good reason.

Truly binary input requires at least a constant-length
key (unless you actually want to provide the key lengths
as attributes somehow); but if the key length is
constant then there is no good reason not to make
gperf work.

There are two reasons why it currently can't work:

1) Newlines characters are ALWAYS treated as the
   beginning of a new key (this voids the attempt
   to allow NUL characters: why not allow '\n' characters?
2) Separators are recognized at any position: if
   your binary keys use all possible 256 values
   per character then there is no character left
   that can be used as separator.

All of this can quite simply be solved by adding
a command line option to specify a (fixed) key length.
Therefore I think this is just lacking and I'd categorize
that as a "bug" :p

More complete binary input support could be added
by allowing the length of keys to be specified in
the input; either on the line of the keys:

3,ABC,0
5,ABCDE,0

where the first number is a length, or by allowing
to specify the length array (that then has to
match the keys), ie:

%lengthtable=3,5
struct AICommonUUID { char const* digest; int asset_type; };
%%
ABC,0
ABCDE,0

where ABCDE are binary characters with arbitrary values
in the full range 0..255.

-- 
Carlo Wood <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]