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

Re: strchr() vs. ber_bvchr()

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" } */

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)?

Maybe NULL is better.

Note that they're currently implemented ad macros, so they cannot be used
inside control statements and so, and they do not return any value.


Pierangelo Masarati

Ing. Pierangelo Masarati
Responsabile Open Solution

SysNet s.n.c.
Via Dossi, 8 - 27100 Pavia - ITALIA
Office:   +39.02.23998309          
Mobile:   +39.333.4963172
Email:    pierangelo.masarati@sys-net.it