Hi [2016-03-16 09:05] [email protected] > One item in the list found in docs/TODO was replace getcpy() with > strdup(). So I've added a subroutine to sbr/utils.c called "mh_xstrdup" > with which I've replaced all calls to getcpy() and to strdup(), except > those in sbr/mf.c; the file sbr/mf.c defines its own getcpy(), so I've > left it alone. See the attached patch.
Thanks for your patch. But your patch doesn't cover all the problems. getcpy() internal use mh_xcalloc, which calls exit() if it fail, but strdup and mh_xstrdup does not. The problem is in the libary[0] (sbr-dir) it's a bad idea to have a function that exit the hole programm. In the programm this is just a nice feature, because you can asume, if malloc fail the programm exit. Therefor you can just use it without checking the return value and call exit() manual. Maybe you add an boolean argument to mh_xstrdump() to choos, if the caller checks the return value or not. The call of advise should also set the ``what'' argument, this causes advertise to check errno and print the accourding error message. Philipp [0]: I know there are a bunch of getcpy/mh_xcalloc/adios calls in the libary, but we shouldn't add more.
pgpueQnnuwAhv.pgp
Description: PGP signature
