aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-10-04 10:47:14 +0200
committerThomas White <taw@physics.org>2012-10-04 10:47:14 +0200
commit877543e38be9c3ef7fa0f7888250b8d7f2453da0 (patch)
tree69b82cf7186d9618e3917b5add3260dbb5df8858 /libcrystfel
parentcf0e84fdf604d0db14f6f52498a01a9175d9bf9a (diff)
Fix a FIXME
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/hdf5-file.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c
index 175b3708..18652566 100644
--- a/libcrystfel/src/hdf5-file.c
+++ b/libcrystfel/src/hdf5-file.c
@@ -672,7 +672,22 @@ void free_copy_hdf5_field_list(struct copy_hdf5_field *n)
void add_copy_hdf5_field(struct copy_hdf5_field *copyme,
const char *name)
{
- assert(copyme->n_fields < copyme->max_fields); /* FIXME */
+ /* Need more space? */
+ if ( copyme->n_fields == copyme->max_fields ) {
+
+ char **nfields;
+ int nmax = copyme->max_fields + 32;
+
+ nfields = realloc(copyme->fields, nmax*sizeof(char *));
+ if ( nfields == NULL ) {
+ ERROR("Failed to allocate space for new HDF5 field.\n");
+ return;
+ }
+
+ copyme->max_fields = nmax;
+ copyme->fields = nfields;
+
+ }
copyme->fields[copyme->n_fields] = strdup(name);
if ( copyme->fields[copyme->n_fields] == NULL ) {