rbuf_auto3
Create a volatile rbuf from static string
Usage
#include <roy.h>
RBuf * rbuf_auto (char *str);
Overview
Create an rbuf from str without the overhead of allocating a new rbuf struct. This call is very similar to rbuf_new_with_static(3) except the returned rbuf comes from a small pool of statically allocated rbufs. Never use rbuf_auto(3) to create long-term rbufs because of the volatility of the static rbuf pool.
Return value
A call to rbuf_auto(3) returns a highly volatile rbuf. The programmer doesn't need to call rbuf_free(3) to free the rbuf, and any attempt to free the rbuf will be ignored. The returned rbuf is marked read-only; see rbuf_rdonly(3) for more details. It is also marked as owned; see rbuf_own(3).
Errors
This call does not error.
Function
The rbuf_auto(3) call is implmented using a function.
Warning
No error checking is done by rbuf_auto(3) to see if there are too many outstanding references to automatic rbufs. If the programer has a reference to an automatic rbuf after a sufficant number of subsequent calls to rbuf_auto(3) the reference held by the programmer will point to a some other static string. By default an automatic rbuf is recycled after 32 calls to rbuf_auto(3), so try never to call rbuf_auto(3) in loops or recursive functions.
Releases
2 releases since Debian 3.0 (Woody); the text changed 1 time.