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-cbf.c | |
parent | 2c9de4119c0fe2338f5f6e54ee91294e3f0f6a74 (diff) |
Move image structure creation up to image_read()
Diffstat (limited to 'libcrystfel/src/image-cbf.c')
-rw-r--r-- | libcrystfel/src/image-cbf.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/libcrystfel/src/image-cbf.c b/libcrystfel/src/image-cbf.c index 5b27c5a5..0d7b914d 100644 --- a/libcrystfel/src/image-cbf.c +++ b/libcrystfel/src/image-cbf.c @@ -599,28 +599,24 @@ static int unpack_panels(struct image *image, DataTemplate *dtempl, } -struct image *image_cbf_read(DataTemplate *dtempl, const char *filename, - const char *event, int gz) +int image_cbf_read(struct image *image, + DataTemplate *dtempl, + const char *filename, + const char *event, + int gz) { - struct image *image; float *data; int w, h; if ( access(filename, R_OK) == -1 ) { ERROR("File does not exist or cannot be read: %s\n", filename); - return NULL; - } - - image = image_new(); - if ( image == NULL ) { - ERROR("Couldn't allocate image structure.\n"); - return NULL; + return 1; } data = read_cbf_data(filename, gz, &w, &h); if ( data == NULL ) { ERROR("Failed to read CBF data\n"); - return NULL; + return 1; } unpack_panels(image, dtempl, data, w, h); @@ -630,5 +626,5 @@ struct image *image_cbf_read(DataTemplate *dtempl, const char *filename, //cbf_fill_in_clen(image->det, f); //fill_in_adu(image); - return image; + return 0; } |