Re: glib outstanding stuff

Joel Becker <jlbec evilplan org> writes: 
> 	If the file is too big, the initial g_new() will fail, so there
> is no crash.  In addition, this saves all the resizings of the g_string.
> As we are willing to read as large a chunk as the kernel will give us,
> we don't need buffering ala stdio.
> 	This is what I have in my personal convenience libs (modulo
> error checking, of course).  If there's a good reason for your version,
> I'd like to know so I can change. :-)

Yes, your version looks better to me (modulo the fact that g_new()
does indeed crash if it fails - but we can just replace it with
g_try_malloc() and it will be fine).


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]