Pas-Kapli / mptp

mPTP - a tool for single-locus species delimitation
GNU Affero General Public License v3.0
24 stars 5 forks source link

Replace hsearch with custom hash table #76

Closed xflouris closed 6 years ago

xflouris commented 7 years ago

Replace the GNU 'hsearch' function with a custom hash table implementation as the `hsearch' function is implemented differently on Linux and Mac (MAC deallocates the associated data automatically, while Linux does not), causing either memory leaks or double frees.

lutteropp commented 7 years ago

Can't we just solve it with an ifdef?

xflouris commented 7 years ago

@algomaus : yes we can, but there are three things:

  1. We don't know if this different behaviour is only on MAC (I know it is on BSD as well).
  2. Some older libc do not have the hsearch functions as it is a GNU function
  3. I spotted this problem like a year ago when working on fastdate, and have since then implemented a fix, so it is just a copy-paste for me.
xflouris commented 6 years ago

finished.