diff options
author | Thomas White <taw@physics.org> | 2020-07-10 11:57:47 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:45 +0200 |
commit | f7ea70e422fafdc886d5829d1bb5f9f3e75d726f (patch) | |
tree | 487df5d5269c9b63ce2d322d564d0058adab86a2 /libcrystfel/src/image-hdf5.c | |
parent | 2c9de4119c0fe2338f5f6e54ee91294e3f0f6a74 (diff) |
Move image structure creation up to image_read()
Diffstat (limited to 'libcrystfel/src/image-hdf5.c')
-rw-r--r-- | libcrystfel/src/image-hdf5.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/libcrystfel/src/image-hdf5.c b/libcrystfel/src/image-hdf5.c index 5461c8a5..5b7a9728 100644 --- a/libcrystfel/src/image-hdf5.c +++ b/libcrystfel/src/image-hdf5.c @@ -525,23 +525,18 @@ static int load_hdf5_hyperslab(struct panel_template *p, } -struct image *image_hdf5_read(DataTemplate *dtempl, - const char *filename, const char *event) +int image_hdf5_read(struct image *image, + DataTemplate *dtempl, + const char *filename, + const char *event) { - struct image *image; int i; - image = image_new(); - if ( image == NULL ) { - ERROR("Couldn't allocate image structure.\n"); - return NULL; - } - image->dp = malloc(dtempl->n_panels*sizeof(float *)); if ( image->dp == NULL ) { ERROR("Failed to allocate data array.\n"); image_free(image); - return NULL; + return 1; } if ( event == NULL ) { @@ -560,14 +555,14 @@ struct image *image_hdf5_read(DataTemplate *dtempl, { ERROR("Failed to load panel data\n"); image_free(image); - return NULL; + return 1; } } image->filename = strdup(filename); image->ev = safe_strdup(event); - return image; + return 0; } |