MIT-LCP / ARCHIVED-wfdb-plus

The Waveform Database Software Package
GNU General Public License v2.0
1 stars 0 forks source link

Replace memory allocation macros #4

Open cx1111 opened 2 years ago

cx1111 commented 2 years ago

My first C++ conversion target is wfdbio.c with wfdb.h and wfdblib.h. Trying to compile this with C++ settings results in several errors from the memory allocation macros, such as: a value of type "void *" cannot be assigned to an entity of type "char *" when calling SALLOC.

List of said macros: https://github.com/bemoody/wfdb/blob/master/doc/wpg-src/wpg0.tex#L4693

We should try to replace them with standard C++ API calls where possible. This may also include replacing char* with std::string where required. I haven't looked into all of the macros, why they are/were needed, or potential solutions, so feel free to discuss all of that in this issue.

Strategy to break down this work:

  1. Identify and document the replacement strategy for each macro
  2. Remove macros and replace usage in lib directory
  3. Replace usage in other directories

Checklist:

cx1111 commented 2 years ago

An alternative working order is to keep the macros for now, and add the required C++ typecasts in order to compile the library. And then to remove the macros one at a time.