Skip to content

Commit

Permalink
Move xraylib-aux.h to include
Browse files Browse the repository at this point in the history
  • Loading branch information
tschoonj committed Dec 27, 2020
1 parent 9ac4f20 commit 7f495aa
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
8 changes: 3 additions & 5 deletions cplusplus/xraylib++.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ THIS SOFTWARE IS PROVIDED BY Tom Schoonjans ''AS IS'' AND ANY EXPRESS OR IMPLIED

#include <xraylib.h>
#include <stdexcept>
#include <new>
#include <complex>
#include <vector>
#include <cstring>

using _compoundDataPod = struct compoundData;
using _radioNuclideDataPod = struct radioNuclideData;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion src/xraylib-aux.h → include/xraylib-aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stddef.h>

XRL_EXTERN
Expand All @@ -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
1 change: 1 addition & 0 deletions include/xraylib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 \
Expand Down
4 changes: 4 additions & 0 deletions src/xraylib-aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
1 change: 0 additions & 1 deletion src/xraylib.i
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ __version__ = VERSION

XRL_GNUC_BEGIN_IGNORE_DEPRECATIONS
#include "xraylib.h"
#include "xraylib-aux.h"
#include "xrf_cross_sections_aux.h"


Expand Down

0 comments on commit 7f495aa

Please sign in to comment.