aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-09-14 11:43:52 +0200
committerThomas White <taw@physics.org>2021-09-17 10:47:09 +0200
commit6482185648e5f9d202a40f1bada7972454f7283b (patch)
tree1656d857ed2b143bfbc33f01ca06c2a8cd26f7c3 /libcrystfel
parentd56cb13bb57bfc39eae2239f37d690bfb82e671d (diff)
Avoid pointless passing of image/event
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/image-cbf.c9
-rw-r--r--libcrystfel/src/image-cbf.h2
-rw-r--r--libcrystfel/src/image-hdf5.c15
-rw-r--r--libcrystfel/src/image-hdf5.h4
-rw-r--r--libcrystfel/src/image.c11
5 files changed, 13 insertions, 28 deletions
diff --git a/libcrystfel/src/image-cbf.c b/libcrystfel/src/image-cbf.c
index 807141d3..d599141c 100644
--- a/libcrystfel/src/image-cbf.c
+++ b/libcrystfel/src/image-cbf.c
@@ -611,19 +611,18 @@ static int unpack_panels(struct image *image,
int image_cbf_read(struct image *image,
const DataTemplate *dtempl,
- const char *filename,
- const char *event,
int gz)
{
float *data;
int w, h;
- if ( access(filename, R_OK) == -1 ) {
- ERROR("File does not exist or cannot be read: %s\n", filename);
+ if ( access(image->filename, R_OK) == -1 ) {
+ ERROR("File does not exist or cannot be read: %s\n",
+ image->filename);
return 1;
}
- data = read_cbf_data(filename, gz, &w, &h);
+ data = read_cbf_data(image->filename, gz, &w, &h);
if ( data == NULL ) {
ERROR("Failed to read CBF data\n");
return 1;
diff --git a/libcrystfel/src/image-cbf.h b/libcrystfel/src/image-cbf.h
index f6936981..5eca1062 100644
--- a/libcrystfel/src/image-cbf.h
+++ b/libcrystfel/src/image-cbf.h
@@ -44,8 +44,6 @@ extern int load_mask_cbf(struct panel_template *p,
extern int image_cbf_read(struct image *image,
const DataTemplate *dtempl,
- const char *filename,
- const char *event,
int gz);
extern int image_cbf_read_mask(struct panel_template *p,
diff --git a/libcrystfel/src/image-hdf5.c b/libcrystfel/src/image-hdf5.c
index cbbc3012..7898d06b 100644
--- a/libcrystfel/src/image-hdf5.c
+++ b/libcrystfel/src/image-hdf5.c
@@ -543,9 +543,7 @@ static int load_hdf5_hyperslab(struct panel_template *p,
int image_hdf5_read(struct image *image,
- const DataTemplate *dtempl,
- const char *filename,
- const char *event)
+ const DataTemplate *dtempl)
{
int i;
@@ -555,16 +553,16 @@ int image_hdf5_read(struct image *image,
return 1;
}
- if ( event == NULL ) {
- event = "//";
+ if ( image->ev == NULL ) {
+ image->ev = "//";
}
/* Set all pointers to NULL for easier clean-up */
for ( i=0; i<dtempl->n_panels; i++ ) image->dp[i] = NULL;
for ( i=0; i<dtempl->n_panels; i++ ) {
- if ( load_hdf5_hyperslab(&dtempl->panels[i], filename,
- event, (void *)&image->dp[i],
+ if ( load_hdf5_hyperslab(&dtempl->panels[i], image->filename,
+ image->ev, (void *)&image->dp[i],
H5T_NATIVE_FLOAT,
sizeof(float), 0,
dtempl->panels[i].data) )
@@ -574,9 +572,6 @@ int image_hdf5_read(struct image *image,
}
}
- image->filename = strdup(filename);
- image->ev = safe_strdup(event);
-
return 0;
}
diff --git a/libcrystfel/src/image-hdf5.h b/libcrystfel/src/image-hdf5.h
index 239bb20d..61cb7c8a 100644
--- a/libcrystfel/src/image-hdf5.h
+++ b/libcrystfel/src/image-hdf5.h
@@ -38,9 +38,7 @@ extern int image_hdf5_read_header_to_cache(struct image *image,
const char *name);
extern int image_hdf5_read(struct image *image,
- const DataTemplate *dtempl,
- const char *filename,
- const char *event);
+ const DataTemplate *dtempl);
extern int image_hdf5_read_mask(struct panel_template *p,
const char *filename,
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index 9fc647ab..2250dc42 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -776,18 +776,13 @@ static int image_read_image_data(struct image *image,
return 1;
case DATA_SOURCE_TYPE_HDF5:
- return image_hdf5_read(image, dtempl,
- image->filename, image->ev);
+ return image_hdf5_read(image, dtempl);
case DATA_SOURCE_TYPE_CBF:
- return image_cbf_read(image, dtempl,
- image->filename, image->ev,
- 0);
+ return image_cbf_read(image, dtempl, 0);
case DATA_SOURCE_TYPE_CBFGZ:
- return image_cbf_read(image, dtempl,
- image->filename, image->ev,
- 1);
+ return image_cbf_read(image, dtempl, 1);
case DATA_SOURCE_TYPE_MSGPACK:
return image_msgpack_read(image, dtempl, image->data_block,