masarati@aero.polimi.it writes:
In fact, it makes no sense that ber_ptr < ber_buf; if it happens, the BerElement is corrupted, and an assertion failure may be more appropriate. Right now, no test is done, and the (trivial) function could be replaced with a macro... Since this is part of the private API, its change should be harmless. Also, it should be renamed ber_int_ptrlen().
The macro exists: ber_pvt_ber_write() in libraries/liblber/lber-int.h.
I'll be introducing a new function ber_tag_t ber_skip_element(BerElement *ber, struct berval *contents); or something like that, you might find that useful instead. Will point *contents into the BerElement, with no alloc or \0-termination.