[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: strchr() vs. ber_bvchr()



Pierangelo Masarati writes:
> I've also added the ber_bv[r]chr_{left,right}() calls that after locating
> the desired char, turn the first argument into a berval containing the
> requested portion of the input one; so, for example,
>
>     struct berval bv = { 16, "0123456789abcdef" }, out;
>
>     ber_bvchr_left( &out, &bv, 'a' );
>     /* sets out = { 10, "0123456789" } */
>
>     ber_bvchr_right( &out, &bv, 'a' );
>     /* sets out = { 6, "abcdef" } */

Please rename these.  The names seem confusing to me.  In particular
ber_bvchr_left()'s function is different from anything I expected from
the name.  Maybe ber_substr_to[r]chr() and ber_substr_from[r]chr(),
though those are a bit long.

> However I'm unsure about the semantics when the char is not found:
> should they return a NULL berval or a berval respectively set to the
> whole input value (left) and to an empty value (the right)?

Whatever is most convenient, as long as the name doesn't indicate the
opposite:-)

-- 
Hallvard