diff --git a/cplusplus/xraylib++.h b/cplusplus/xraylib++.h index 4f44ead3..48da95d6 100644 --- a/cplusplus/xraylib++.h +++ b/cplusplus/xraylib++.h @@ -16,10 +16,8 @@ THIS SOFTWARE IS PROVIDED BY Tom Schoonjans ''AS IS'' AND ANY EXPRESS OR IMPLIED #include #include -#include #include #include -#include using _compoundDataPod = struct compoundData; using _radioNuclideDataPod = struct radioNuclideData; @@ -338,8 +336,8 @@ namespace xrlpp { n_atom(atoms.size()), atom(atoms) { - cs = (Crystal_Struct *) malloc(sizeof(Crystal_Struct)); - cs->name = strdup(name.c_str()); + cs = (Crystal_Struct *) xrl_malloc(sizeof(Crystal_Struct)); + cs->name = xrl_strdup(name.c_str()); cs->a = a; cs->b = b; cs->c = c; @@ -348,7 +346,7 @@ namespace xrlpp { cs->gamma = gamma; cs->volume = volume; cs->n_atom = n_atom; - cs->atom = (Crystal_Atom *) malloc(sizeof(Crystal_Atom) * n_atom); + cs->atom = (Crystal_Atom *) xrl_malloc(sizeof(Crystal_Atom) * n_atom); for (int i = 0 ; i < n_atom ; i++) { cs->atom[i].Zatom = atoms[i].Zatom; cs->atom[i].fraction = atoms[i].fraction; diff --git a/include/Makefile.am b/include/Makefile.am index be2fbb48..1db48276 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -10,4 +10,5 @@ xraylibinclude_HEADERS = xraylib.h \ xraylib-nist-compounds.h \ xraylib-radionuclides.h \ xraylib-error.h \ - xraylib-deprecated.h + xraylib-deprecated.h \ + xraylib-aux.h diff --git a/src/xraylib-aux.h b/include/xraylib-aux.h similarity index 96% rename from src/xraylib-aux.h rename to include/xraylib-aux.h index cde7ec57..8b6f04bc 100644 --- a/src/xraylib-aux.h +++ b/include/xraylib-aux.h @@ -14,7 +14,7 @@ THIS SOFTWARE IS PROVIDED BY Tom Schoonjans ''AS IS'' AND ANY EXPRESS OR IMPLIED #ifndef _XRAYLIB_AUX_H #define _XRAYLIB_AUX_H -#include "xraylib.h" +#ifndef SWIG #include XRL_EXTERN @@ -23,4 +23,8 @@ char *xrl_strdup(const char *str); XRL_EXTERN char *xrl_strndup(const char *str, size_t len); +XRL_EXTERN +void *xrl_malloc(size_t size); + +#endif #endif diff --git a/include/xraylib.h b/include/xraylib.h index 1b65f3dc..27543112 100644 --- a/include/xraylib.h +++ b/include/xraylib.h @@ -63,6 +63,7 @@ extern "C" { #include "xraylib-nist-compounds.h" #include "xraylib-radionuclides.h" #include "xraylib-deprecated.h" +#include "xraylib-aux.h" /* * Siegbahn notation diff --git a/src/Makefile.am b/src/Makefile.am index 9213db95..80fb2476 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -48,9 +48,8 @@ libprdata_la_SOURCES = \ radrate.c \ auger_trans.c \ kissel_pe.c \ - cross_sections.c \ - xraylib-aux.c \ - xraylib-aux.h + cross_sections.c \ + xraylib-aux.c libprdata_la_LIBADD = $(LIBM) @@ -80,7 +79,6 @@ libxrl_la_SOURCES = xrayvars.c \ xrayglob.h \ xrayvars.h \ xraylib-aux.c \ - xraylib-aux.h \ xraylib-parser.c \ cs_cp.c \ refractive_indices.c \ diff --git a/src/xraylib-aux.c b/src/xraylib-aux.c index 0c2f170d..99343c79 100644 --- a/src/xraylib-aux.c +++ b/src/xraylib-aux.c @@ -40,3 +40,7 @@ char *xrl_strndup(const char *str, size_t len) { return strndup(str, len); #endif } + +void *xrl_malloc(size_t size) { + return malloc(size); +} \ No newline at end of file diff --git a/src/xraylib.i b/src/xraylib.i index 5cd44d4f..b942bb63 100644 --- a/src/xraylib.i +++ b/src/xraylib.i @@ -61,7 +61,6 @@ __version__ = VERSION XRL_GNUC_BEGIN_IGNORE_DEPRECATIONS #include "xraylib.h" -#include "xraylib-aux.h" #include "xrf_cross_sections_aux.h"