tech-userlevel archive

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

Re: regsub() proposal

On Sat, Jan 09, 2016 at 02:19:50PM +0700, Robert Elz wrote:
 > Lastly, since this is all new, it seems as if having 2 funcs is not
 > really required, already if one calls your regsub with a NULL buf
 > arg, it looks to me as if it acts just like aregsub - except the
 > caller has no way to discover where the result got put.   Wouldn't
 > one function, what can be used either way, be sufficient?

That's kinda my fault -- the original version just returned a char *,
and I observed yesterday that it would be nice to have one that didn't
allocate. Hence, one like snprintf and one like asprintf.

One like getcwd(3) instead might be a better idea. Although given a
fixed buffer the snprintf model for dealing with overflow isn't a bad

David A. Holland

Home | Main Index | Thread Index | Old Index