diff options
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; } |