On Sat, Jun 02, 2012 at 05:23:52PM -0400, Jorge Arellano Cid wrote:
Hi,
On Sun, Jun 03, 2012 at 12:13:41AM +0400, 123 wrote:
malloc.diff: added perror calls for malloc and realloc errors
dstr.diff: dStr* functions cleanup
dlist.diff: replaced recursive QuickSort with qsort from stdlib.h. Tested with file.dpi where it is used for sorting directory listing.
There're different criteria to write code. In dlib, a few lines are preferred to a single contracted one to make it simpler to understand. In the same spirit, scattered return statements are avoided to make code path following simpler.
What about perror in malloc? It is still better than silent exit(1).
For quick sort I remember having to implement it in dlib because stdlib's qsort varies among platforms.
I can only find reports about problems in Solaris qsort related to performance. There should be no known problems in platforms listed on http://www.dillo.org/Compatibility.html and qsort is a part of POSIX/SUS. qsort is also used in lout/container.cc so broken qsort will break dillo anyway.