Commit Graph

13 Commits (main)

Author SHA1 Message Date
Rob Davies 96e445d9e4 Reduce dependency on utils.h - new malloc wrapping scheme.
Remove xmalloc, xcalloc, xrealloc and xstrdup from utils.h and revert calls
to the normal malloc, calloc, realloc, strdup.  Add new files malloc_wrap.[ch]
with the wrapper functions.  malloc_wrap.h #defines malloc etc. to the
wrapper, but only if USE_MALLOC_WRAPPERS has been defined.

Put #include "malloc_wrap.h" in any file that uses *alloc or strdup.  This
is also in a #ifdef USE_MALLOC_WRAPPERS ... #endif block to make using the
wrappers optional.  Add -DUSE_MALLOC_WRAPPERS into the makefile so they
should normally get added.

This is an improvement on the previous method as we now don't need to
worry about stray function calls that were not changed to the wrapped version
and the code will still work even if the wrapping is disabled.

Other possible methods of doing this are using malloc_hook (glibc-specific),
adding -include malloc_wrap.h to the gcc command-line (somewhat
gcc-specific) or making our own malloc function and using dlopen (scary).
This way is probably the most portable.
2013-05-02 15:12:01 +01:00
Rob Davies b081ac9b8b Use wrapper functions to catch system errors
Use the wrapper functions in utils.c plus a few extra bits of error
checking code to catch system errors and exit non-zero when they occur.
2012-12-16 10:34:57 +00:00
Heng Li c8c79ef024 mate rescue seems working (not MT) 2011-11-06 16:20:40 -05:00
Heng Li 02946df28a fixed a off-by-1 bug 2011-10-27 13:55:48 -04:00
Heng Li aabb807734 concatenate for-rev sequences in the end 2011-10-25 11:22:08 -04:00
Heng Li b59fd2bf47 fixed an integer overflow 2011-10-24 14:39:57 -04:00
Heng Li b204437c7e fixed negative mapping quality; still byggy 2011-10-24 14:00:36 -04:00
Heng Li 8512b55ce3 bwasw works on a couple of sequences 2011-10-24 13:42:32 -04:00
Heng Li 4c43c5914d this is better; but still buggy 2011-10-24 11:50:11 -04:00
Heng Li 29c3acfb31 not segfault immediately; but buggy 2011-10-24 09:36:52 -04:00
Heng Li b3397a1f14 changes to bwa-sw for the 64-bit support; unfinish 2011-10-21 13:32:45 -04:00
Heng Li c948c647a0 make changes to bwt.c 2011-10-19 17:42:42 -04:00
Heng Li 007c3eb75d Imported from my local bwa repository, the master repository. 2011-01-13 20:52:12 -05:00