Commit Graph

30 Commits (96e445d9e43e7d4a4cb32a1681098a6e7a170561)

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 90ecd344ba Merge branch 'master' into master_fixes. Merged up to master r375.
Conflicts:
	bwt.c
2013-04-11 11:15:39 +01:00
Heng Li d64eaa851d fixed an issue caused by a Mac/Darwin bug
On Mac/Darwin, it is not possible to read >2GB data with one fread().
2013-04-09 15:17:04 -04:00
Rob Davies 3d33ab063e Merge branch 'master' into master_fixes
Merged to master version b621d3a

Conflicts:
	Makefile
	bntseq.c
	bwa.c
	bwase.c
	bwaseqio.c
	bwtaln.c
	bwtindex.c
	bwtio.c
	bwtmisc.c
	bwtsw2_aux.c
	cs2nt.c
	fastmap.c
	khash.h
	kseq.h
	ksw.c
	kvec.h
	simple_dp.c
	utils.c
	utils.h
2013-03-01 09:37:46 +00:00
Heng Li aa92c720b5 cleanup bwt_occ() 2013-02-26 12:09:28 -05:00
Heng Li 80e1137a6c move bwt_invPsi() from bwt.h to bwt.c 2013-02-26 11:57:36 -05:00
Heng Li fd67064207 removed an unnecessary condition 2013-02-26 11:51:03 -05:00
Heng Li 264d5e42e5 simplified bwt_occ4() a little 2013-02-26 11:49:39 -05:00
Heng Li c848b44481 code backup 2013-02-26 11:22:24 -05:00
Heng Li 174fe0f1d5 code backup: less dependent on gcc optimization 2013-02-26 11:14:19 -05:00
Heng Li f122fad562 minor code clean up
bwtio.c is merged to bwt.c
2013-02-22 17:09:40 -05:00
Heng Li abc675f278 typo in comments 2013-02-01 13:14:16 -05:00
Heng Li 86f2e134ba no effective changes 2013-02-01 12:57:48 -05:00
Heng Li 91debf412b move smem iterators to bwamem.{c,h} 2013-01-31 13:59:48 -05:00
Heng Li 5a4a0c4173 a bit refactoring for further changes 2013-01-31 12:34:05 -05:00
Heng Li 6de74888fd bugfix: min_intv not working in SMEM 2013-01-31 12:12:58 -05:00
Heng Li 543c719a54 fixed a couple of unimportant bugs in SMEM 2013-01-31 11:53:07 -05:00
Heng Li 6641788d38 preparation for further changes 2013-01-31 11:42:31 -05: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
Shaun Jackman 84d34e1d0b Do not inline functions used externally
Compiling using CLANG gives the following errors:
Undefined symbols for architecture x86_64:
  "_bwt_occ", referenced from:
      _bwt_cal_sa in bwt.o
      _bwt_sa in bwt.o
  "_bwt_2occ", referenced from:
      _bwt_match_exact in bwt.o
      _bwt_match_exact_alt in bwt.o
      _bwt_cal_width in bwtaln.o
  "_bwt_2occ4", referenced from:
      _bwt_match_gap in bwtgap.o
      _bsw2_core in bwtsw2_core.o
  "_bwtl_2occ4", referenced from:
      _bsw2_core in bwtsw2_core.o
2012-06-25 12:48:43 -07:00
Heng Li 150bfbdef4 fixed a deadlock; SMEM iterator 2011-11-24 19:15:14 -05:00
Heng Li eeedda105d perhaps improves samse/sampe 2011-11-24 01:22:02 -05:00
Heng Li 4083fe9413 fixed a typo 2011-11-02 09:03:05 -04:00
Heng Li 673ae4aaf8 throw an error if insufficient memory during index 2011-10-31 13:26:24 -04:00
Heng Li f56edd07dd forward-backward search seems working 2011-10-25 12:31:36 -04:00
Heng Li 7626595e3a backup the current debugging code; more changes 2011-10-25 10:03:57 -04:00
Heng Li 22c2252e15 added bidirectional bwt; seems buggy 2011-10-25 00:22:28 -04:00
Heng Li b7e8c4c5aa fixed a bug in 2occ4() 2011-10-20 11:23:23 -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