From a851516f08edab1f54592b4e6df5ff87d3c6dfd5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 2 Jun 2020 13:04:53 +0200 Subject: Add detgeom_free --- libcrystfel/src/detgeom.c | 14 ++++++++++++++ libcrystfel/src/detgeom.h | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/detgeom.c b/libcrystfel/src/detgeom.c index 18fbd220..7633ca54 100644 --- a/libcrystfel/src/detgeom.c +++ b/libcrystfel/src/detgeom.c @@ -31,6 +31,7 @@ #endif #include +#include #include "detgeom.h" @@ -62,3 +63,16 @@ void detgeom_transform_coords(struct detgeom_panel *p, r[1] = sin(twotheta)*sin(az) / wavelength; r[2] = (ctt - 1.0) / wavelength; } + + +void detgeom_free(struct detgeom *detgeom) +{ + int i; + + for ( i=0; in_panels; i++ ) { + free(detgeom->panels[i].name); + } + + free(detgeom->panels); + free(detgeom); +} diff --git a/libcrystfel/src/detgeom.h b/libcrystfel/src/detgeom.h index 4d80df6b..67a33307 100644 --- a/libcrystfel/src/detgeom.h +++ b/libcrystfel/src/detgeom.h @@ -53,7 +53,7 @@ extern "C" { struct detgeom_panel { /** Text name for panel */ - const char *name; + char *name; /** \name Location of corner in units of the pixel size of this panel, \ * measured from the interaction point. */ @@ -101,6 +101,8 @@ extern void detgeom_transform_coords(struct detgeom_panel *p, double wavelength, double *r); +extern void detgeom_free(struct detgeom *detgeom); + #ifdef __cplusplus } #endif -- cgit v1.2.3