* Debarshi Ray wrote on Wed, Aug 20, 2008 at 09:40:13PM CEST:
> Oops sorry! This one is hopefully better.
I don't think you want to recv more than BUFSIZ bytes; and then you
shouldn't need to call realloc for every recv. Only when the next recv
answer will not fit in the current buffer size any m
> What's the use-case of this function? You said that you want to "safely"
> read from sockfd, but can you explain what you mean by that?
I am actually reading from a PF_NETLINK socket and want the entire
data, which can be spread over multiple consecutive messages, in a
buffer. Now the BUFSIZ doc
Simon Josefsson <[EMAIL PROTECTED]> writes:
> - date=`date +%Y%m%d-%H%M%S`
> + date=`TZ=UTC date +%Y%m%d-%H%M%S`
Although this change will work on many hosts, it is not portable in
general. It should say TZ=UTC0 to conform to POSIX.
Yoann Vandoorselaere wrote:
> - Isolate thread specific CPP flags into THREADCPPFLAGS (this is useful
> for a library to propagate threads specific CPPFLAGS).
What do you mean by that? Do you mean that the users of a library need to
use the same CPPFLAGS as those with which library was compiled? T
Debarshi Ray wrote:
> size_t
> recvbuf (int sockfd, void **buffer, size_t *size)
> {
> size_t block = BUFSIZ;
> size_t count = 0;
> ssize_t nread;
>
> if (*buffer == NULL)
> *size = block;
>
> for (;;)
> {
> *buffer = xrealloc (*buffer, *size);
> nread = recv (sockfd
Oops sorry! This one is hopefully better.
size_t
recvbuf (int sockfd, void **buffer, size_t *size)
{
size_t block = BUFSIZ;
size_t count = 0;
ssize_t nread;
if (*buffer == NULL)
*size = block;
for (;;)
{
*buffer = xrealloc (*buffer, *size);
nread = recv (sockfd, *bu
* Debarshi Ray wrote on Tue, Aug 19, 2008 at 10:57:33PM CEST:
> > FWIW, your current algorithm of adding BUFSIZ to size causes nonlinear
> > amount of work done in realloc, for reading large files. You might
> > want to increase memory by a constant factor or BUFSIZ, whichever is
> > larger (e.g.,