[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: snprintf() revisited, please comment
- To: ports_(_at_)_openbsd_(_dot_)_org
- Subject: Re: snprintf() revisited, please comment
- From: Robbert Haarman <openbsd_ports_(_at_)_inglorion_(_dot_)_net>
- Date: Tue, 23 Aug 2005 21:13:09 +0200
Perhaps this is a silly question or has been covered already, but I'm
curious:
> - find out overall length of n parts that shall be reassembled in some
> way and add 1 for the terminating NUL
> - if re- or malloc()'ing the required buffer size failed, then
If you're allocating memory anyway, why wouldn't you use asprintf
instead? That should basically do all the steps you listed for you. If
need be, you can always add an asprintf implementation for those
platforms that don't provide it natively. Is there anything against this
approach?
-- Bob
Visit your host, monkey.org