aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-06-12 10:47:55 +0200
committerThomas White <taw@physics.org>2020-07-29 18:53:44 +0200
commitd3b90e0194172285b31491fcd7082c2b4d82d788 (patch)
tree61a66dfafee5f604d58cb52eaac8a576192855f0
parent7617a4adccf8f6cb3845c1ac018abae949dafef1 (diff)
Remove events.c, part 1
-rw-r--r--libcrystfel/CMakeLists.txt2
-rw-r--r--libcrystfel/src/datatemplate.c1
-rw-r--r--libcrystfel/src/events.c644
-rw-r--r--libcrystfel/src/events.h112
-rw-r--r--libcrystfel/src/image-cbf.c1
-rw-r--r--libcrystfel/src/image-hdf5.c1
-rw-r--r--libcrystfel/src/image-msgpack.c1
-rw-r--r--libcrystfel/src/image.c1
-rw-r--r--libcrystfel/src/image.h6
-rw-r--r--src/im-sandbox.c2
-rw-r--r--src/im-zmq.c1
-rw-r--r--src/list_events.c20
12 files changed, 13 insertions, 779 deletions
diff --git a/libcrystfel/CMakeLists.txt b/libcrystfel/CMakeLists.txt
index b3a7764c..6bc74981 100644
--- a/libcrystfel/CMakeLists.txt
+++ b/libcrystfel/CMakeLists.txt
@@ -52,7 +52,6 @@ set(LIBCRYSTFEL_SOURCES
src/xds.c
src/integration.c
src/predict-refine.c
- src/events.c
src/felix.c
src/peakfinder8.c
src/taketwo.c
@@ -97,7 +96,6 @@ set(LIBCRYSTFEL_HEADERS
src/xds.h
src/predict-refine.h
src/integration.h
- src/events.h
src/asdf.h
src/felix.h
src/peakfinder8.h
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c
index b9a30e0e..54d29807 100644
--- a/libcrystfel/src/datatemplate.c
+++ b/libcrystfel/src/datatemplate.c
@@ -38,7 +38,6 @@
#include "utils.h"
#include "datatemplate.h"
-#include "events.h"
#include "datatemplate_priv.h"
diff --git a/libcrystfel/src/events.c b/libcrystfel/src/events.c
deleted file mode 100644
index 1e711e6a..00000000
--- a/libcrystfel/src/events.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * events.c
- *
- * Event properties
- *
- * Copyright © 2012-2020 Deutsches Elektronen-Synchrotron DESY,
- * a research centre of the Helmholtz Association.
- *
- * Authors:
- * 2017 Thomas White
- * 2014 Valerio Mariani
- *
- * This file is part of CrystFEL.
- *
- * CrystFEL is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * CrystFEL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "events.h"
-#include "utils.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <stddef.h>
-
-/** \file events.h */
-
-struct event *initialize_event()
-{
-
- struct event *ev;
-
- ev = malloc(sizeof(struct event));
- ev->path_entries = NULL;
- ev->path_length = 0;
-
- ev->dim_entries = NULL;
- ev->dim_length = 0;
-
- return ev;
-
-}
-
-
-struct event_list *initialize_event_list()
-{
-
- struct event_list *ev_list;
-
- ev_list = malloc(sizeof(struct event_list));
-
- ev_list->events = NULL;
- ev_list->num_events = 0;
-
- return ev_list;
-
-}
-
-struct filename_plus_event *initialize_filename_plus_event()
-{
- struct filename_plus_event *fpe;
-
- fpe = malloc(sizeof(struct filename_plus_event));
- if ( fpe == NULL ) return NULL;
-
- fpe->filename = NULL;
- fpe->ev = NULL;
-
- return fpe;
-}
-
-
-int event_cmp(struct event *ev1, struct event *ev2)
-{
- int pi;
- int di;
-
- if ( ev1->path_length != ev2->path_length ||
- ev1->dim_length != ev2->dim_length ) {
- return 1;
- }
-
- for ( pi=0; pi<ev1->path_length; pi++ ) {
- if ( strcmp(ev1->path_entries[pi], ev2->path_entries[pi]) != 0 ) {
- return 1;
- }
- }
-
- for ( di=0; di<ev1->dim_length; di++ ) {
- if ( ev1->path_entries[di] != ev2->path_entries[di] ) {
- return 1;
- }
- }
-
- return 0;
-
-}
-
-
-int add_non_existing_event_to_event_list(struct event_list *ev_list,
- struct event *ev)
-{
- int evi;
- int found = 0;
-
- for ( evi=0; evi<ev_list->num_events; evi++ ) {
- if (event_cmp(ev_list->events[evi], ev) == 0 ) {
- found = 1;
- break;
- }
- }
-
- if ( found == 0) {
- return append_event_to_event_list(ev_list, ev);
- }
-
- return 0;
-}
-
-
-int append_event_to_event_list(struct event_list *ev_list, struct event *ev)
-{
- struct event **new_el;
-
- new_el = realloc(ev_list->events,
- (1+ev_list->num_events)*sizeof(struct event*));
- if ( new_el == NULL ) return 1;
-
- ev_list->events = new_el;
- ev_list->events[ev_list->num_events] = copy_event(ev);
- ev_list->num_events +=1;
-
- return 0;
-}
-
-
-struct event *copy_event(struct event *ev)
-{
- struct event *new_ev;
- int pi, di;
-
- if ( ev == NULL ) return NULL;
-
- if ( ev->dim_length == 0 && ev->path_length == 0) {
-
- new_ev = initialize_event();
-
- } else {
-
- new_ev=malloc(sizeof(struct event));
-
- new_ev->path_entries = malloc(ev->path_length*sizeof(char *));
- new_ev->path_length = ev->path_length;
-
- new_ev->dim_entries = malloc(ev->dim_length*sizeof(int *));
- new_ev->dim_length = ev->dim_length;
-
- for ( pi=0; pi<new_ev->path_length; pi++ ) {
- new_ev->path_entries[pi] = strdup(ev->path_entries[pi]);
- }
-
- for ( di=0; di<new_ev->dim_length; di++ ) {
- new_ev->dim_entries[di] = ev->dim_entries[di];
- }
-
- }
- return new_ev;
-}
-
-
-struct event_list *copy_event_list(struct event_list *el)
-{
- int ei;
- struct event_list *el_copy;
- struct event **events_copy;
-
- el_copy = malloc(1);
- if ( el_copy == NULL ) {
- return NULL;
- }
-
- events_copy = malloc(el->num_events);
- if ( events_copy == NULL ) {
- free (el_copy);
- return NULL;
- }
- el_copy->events = events_copy;
-
- for ( ei=0; ei<el->num_events; ei++ ) {
- el_copy->events[ei]=copy_event(el->events[ei]);
- }
-
- el_copy->num_events = el->num_events;
-
- return el_copy;
-}
-
-
-static int events_equal(struct event *ev1, struct event *ev2)
-{
- int i;
-
- if ( ev1->path_length != ev2->path_length ) return 0;
- if ( ev1->dim_length != ev2->dim_length ) return 0;
-
- for ( i=0; i<ev1->path_length; i++ ) {
- if ( strcmp(ev1->path_entries[i], ev2->path_entries[i]) != 0 ) {
- return 0;
- }
- }
-
- for ( i=0; i<ev1->dim_length; i++ ) {
- if ( ev1->dim_entries[i] != ev2->dim_entries[i] ) return 0;
- }
-
- return 1;
-}
-
-
-/**
- * \param ev: An event structure
- * \param el: An event list
- *
- * \returns The indexing into \p el of the event matching \p ev, of el->num_events
- * if no such event is found.
- **/
-int find_event(struct event *ev, struct event_list *el)
-{
- int i;
-
- if ( ev == NULL ) return el->num_events;
-
- for ( i=0; i<el->num_events; i++ ) {
- if ( events_equal(ev, el->events[i]) ) return i;
- }
-
- return i;
-}
-
-
-void free_event(struct event *ev)
-{
- int pi;
-
- if ( ev == NULL ) return;
-
- if ( ev->path_length != 0 ) {
- for ( pi=0; pi<ev->path_length; pi++ ) {
- free(ev->path_entries[pi]);
- }
- }
- free(ev->dim_entries);
- free(ev);
-}
-
-
-void free_event_list(struct event_list *el)
-{
- int ei;
-
- if ( el == NULL ) return;
-
- for ( ei=0; ei<el->num_events; ei++ ) {
- free_event(el->events[ei]);
- }
- free(el);
-}
-
-
-void free_filename_plus_event(struct filename_plus_event *fpe)
-{
- free(fpe->filename);
-
- if ( fpe->ev != NULL ) {
- free_event(fpe->ev);
- }
-
- free(fpe);
-}
-
-
-char *get_event_string(struct event *ev)
-{
- char *evstr;
- int i;
- size_t ev_len;
-
- if ( ev == NULL ) return strdup("(none)");
-
- ev_len = 1; /* Zero terminator */
- for ( i=0; i<ev->path_length; i++ ) {
- ev_len += strlen(ev->path_entries[i]);
- ev_len += 1; /* Slash afterwards */
- }
- ev_len += 16*ev->dim_length; /* Max length of number plus slash */
- ev_len += 2; /* Double slash in middle */
-
- evstr = malloc(ev_len);
- if ( evstr == NULL ) return NULL;
- evstr[0] = '\0';
-
- for ( i=0; i<ev->path_length; i++ ) {
- if ( i > 0 ) strcat(evstr, "/");
- strcat(evstr, ev->path_entries[i]);
- }
-
- strcat(evstr, "//");
-
- for ( i=0; i<ev->dim_length; i++ ) {
- char num_buf[16];
- snprintf(num_buf, 16, "%i", ev->dim_entries[i]);
- if ( i > 0 ) strcat(evstr, "/");
- strcat(evstr, num_buf);
- }
-
- return evstr;
-}
-
-
-struct event *get_event_from_event_string(const char *ev_string)
-{
- struct event *ev;
- char *ev_sep;
- char buf_path[1024];
- char buf_dim[1024];
- char *sep;
- char *start;
-
- if ( ev_string == NULL ) return NULL;
-
- ev_sep = strstr(ev_string, "//");
- if ( ev_sep == NULL ) return NULL;
-
- strncpy(buf_path, ev_string, ev_sep-ev_string);
- buf_path[ev_sep-ev_string] = '\0';
-
- strncpy(buf_dim, ev_sep+2, strlen(ev_sep)-2);
- buf_dim[strlen(ev_sep)-2] = '\0';
-
- ev = initialize_event();
- if ( ev == NULL ) return NULL;
-
- if ( strlen(buf_path) !=0 ) {
- start = buf_path;
- do {
- char buf[2014];
-
- sep = strstr(start, "/");
-
- if ( sep != NULL ) {
- strncpy(buf, start, sep-start);
- buf[sep-start]='\0';
- push_path_entry_to_event(ev, buf);
- start = sep + 1;
-
- } else {
-
- sprintf(buf,"%s",start);
- push_path_entry_to_event(ev, buf);
-
- }
-
- } while (sep);
-
- }
-
- if ( strlen(buf_dim) !=0 ) {
-
- start = buf_dim;
-
- do {
-
- char buf[2014];
- int buf_int;
-
- sep = strstr(start, "/");
- if ( sep != NULL ) {
- strncpy(buf, start, sep-start);
- buf[sep-start]='\0';
- buf_int = atoi(buf);
- push_dim_entry_to_event(ev, buf_int);
- start = sep + 1;
-
- } else {
-
- sprintf(buf,"%s",start);
- buf_int = atoi(buf);
- push_dim_entry_to_event(ev, buf_int);
-
- }
-
- } while (sep);
-
- }
-
- return ev;
-}
-
-
-int push_path_entry_to_event(struct event *ev, const char *entry)
-{
- char **new_path_entries;
-
- new_path_entries = realloc(ev->path_entries,
- (1+ev->path_length)*sizeof(char *));
- if ( new_path_entries == NULL ) return 1;
-
- ev->path_entries = new_path_entries;
- ev->path_entries[ev->path_length] = strdup(entry);
- ev->path_length += 1;
-
- return 0;
-}
-
-
-int push_dim_entry_to_event(struct event *ev, int entry)
-{
- int *new_dim_entries;
-
- new_dim_entries = realloc(ev->dim_entries,
- (1+ev->dim_length)*sizeof(int));
- if ( new_dim_entries == NULL ) return 1;
-
- ev->dim_entries = new_dim_entries;
- ev->dim_entries[ev->dim_length] = entry;
- ev->dim_length += 1;
-
- return 0;
-}
-
-
-int pop_path_entry_from_event(struct event *ev)
-{
- char **new_path_entries;
-
- if ( ev->path_length == 0 ) return 1;
-
- free(ev->path_entries[ev->path_length-1]);
-
- if ( ev->path_length == 1 ) {
- ev->path_entries = NULL;
- ev->path_length = 0;
- return 0;
- }
-
- new_path_entries = realloc(ev->path_entries,
- (ev->path_length-1)*sizeof(char *));
-
- if ( new_path_entries == NULL ) return 1;
-
- ev->path_entries = new_path_entries;
- ev->path_length = ev->path_length-1;
-
- return 0;
-}
-
-
-int pop_dim_entry_from_event(struct event *ev)
-{
- int *new_dim_entries;
-
- if ( ev->dim_length == 0 ) {
- return 1;
- }
-
- if ( ev->dim_length == 1 ) {
- ev->dim_entries = NULL;
- ev->dim_length = 0;
- return 0;
- }
-
- new_dim_entries = realloc(ev->dim_entries,
- (ev->dim_length-1)*sizeof(int));
-
- if ( new_dim_entries == NULL) {
- return 1;
- }
-
- ev->dim_entries = new_dim_entries;
- ev->dim_length = ev->dim_length-1;
-
- return 0;
-}
-
-
-char *event_path_placeholder_subst(const char *entry, const char *data)
-{
-
- char *ph_loc;
- char *full_path;
- ptrdiff_t len_head;
- size_t len_entry, len_data;
-
- len_entry = strlen(entry);
- len_data = strlen(data);
- full_path = malloc(len_data + len_entry + 1);
- if ( full_path == NULL ) return NULL;
-
- ph_loc = strchr(data, '%');
- len_head = ph_loc - data;
- assert(len_head >= 0);
-
- strncpy(full_path, data, len_head);
- full_path[len_head] = '\0';
- strcat(full_path, entry);
- strcat(full_path, ph_loc+1);
-
- return full_path;
-}
-
-
-char *retrieve_full_path(struct event *ev, const char *data)
-{
- int ei ;
- char *return_value;
- char *pholder;
-
- if ( data == NULL ) {
- ERROR("HDF5 location must not be NULL\n");
- return NULL;
- }
-
- return_value = strdup(data);
- pholder = strstr(return_value, "%");
- ei = 0;
-
- while ( pholder != NULL ) {
-
- char *tmp;
-
- /* Check we have enough things to put in the placeholders */
- if ( ei >= ev->path_length ) {
- ERROR("Too many placeholders ('%%') in location.\n");
- return NULL;
- }
-
- /* Substitute one placeholder */
- tmp = event_path_placeholder_subst(ev->path_entries[ei++],
- return_value);
-
- if ( tmp == NULL ) {
- ERROR("Couldn't substitute placeholder\n");
- return NULL;
- }
-
- /* Next time, we will substitute the next part of the path into
- * the partially substituted string */
- free(return_value);
- return_value = tmp;
-
- pholder = strstr(return_value, "%");
-
- }
-
- return return_value;
-}
-
-
-struct dim_structure *initialize_dim_structure()
-{
- struct dim_structure *hs;
-
- hs = malloc(sizeof(struct dim_structure));
- if ( hs == NULL ) return NULL;
-
- hs->dims = NULL;
- hs->num_dims = 0;
-
- return hs;
-}
-
-
-struct dim_structure *default_dim_structure()
-{
- struct dim_structure *hsd;
-
- hsd = initialize_dim_structure();
-
- set_dim_structure_entry(hsd, 0, "ss");
- set_dim_structure_entry(hsd, 1, "fs");
-
- return hsd;
-}
-
-
-void free_dim_structure(struct dim_structure *hsd)
-{
- if ( hsd == NULL ) return;
- free(hsd->dims);
- free(hsd);
-}
-
-
-static int parse_dim_structure_val(const char *val)
-{
- if ( strcmp(val,"%") == 0 ) {
- return HYSL_PLACEHOLDER;
- } else if ( strcmp(val,"ss") == 0 ) {
- return HYSL_SS;
- } else if ( strcmp(val,"fs") == 0 ) {
- return HYSL_FS;
- }
- return atoi(val);
-
-}
-
-
-int set_dim_structure_entry(struct dim_structure *hsd, int dim_entry,
- const char *val_string)
-{
- /* "dims" array needs element with zero index */
- if ( dim_entry >= hsd->num_dims ) {
-
- int di;
-
- int *new_dims = realloc(hsd->dims, (dim_entry+1)*sizeof(int));
- if ( new_dims == NULL ) return 1;
-
- /* Initialise the elements just allocated */
- for ( di=hsd->num_dims; di<=dim_entry; di++ ) {
- new_dims[di] = HYSL_UNDEFINED;
- }
-
- hsd->dims = new_dims;
- hsd->num_dims = dim_entry+1;
-
- }
-
- hsd->dims[dim_entry] = parse_dim_structure_val(val_string);
-
- return 0;
-}
diff --git a/libcrystfel/src/events.h b/libcrystfel/src/events.h
deleted file mode 100644
index 4e5782b5..00000000
--- a/libcrystfel/src/events.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * events.h
- *
- * Event properties
- *
- * Copyright © 2012-2020 Deutsches Elektronen-Synchrotron DESY,
- * a research centre of the Helmholtz Association.
- *
- * Authors:
- * 2014 Valerio Mariani
- *
- * This file is part of CrystFEL.
- *
- * CrystFEL is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * CrystFEL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef EVENTS_H
-#define EVENTS_H
-
-/**
- * \file events.h
- * Event description structures
- */
-
-struct event
-{
- char **path_entries;
- int path_length;
- int *dim_entries;
- int dim_length;
-};
-
-/* FIXME: Deprecated */
-struct event_list
-{
- struct event **events;
- int num_events;
-};
-
-/* FIXME: Deprecated */
-struct filename_plus_event
-{
- char *filename;
- struct event *ev;
-};
-
-enum dimension_id
-{
- HYSL_UNDEFINED = -99,
- HYSL_PLACEHOLDER = -98,
- HYSL_FS = -1,
- HYSL_SS = -2
-};
-
-struct dim_structure
-{
- int *dims;
- int num_dims;
-};
-
-extern struct event *initialize_event(void);
-extern int push_path_entry_to_event(struct event *ev, const char *entry);
-extern int pop_path_entry_from_event(struct event *ev);
-extern int push_dim_entry_to_event(struct event *ev, int entry);
-extern int pop_dim_entry_from_event(struct event *ev);
-extern struct event *copy_event(struct event *ev);
-extern void free_event(struct event *ev);
-extern char *get_event_string(struct event *ev);
-extern struct event *get_event_from_event_string(const char *ev_string);
-extern char *event_path_placeholder_subst(const char *ev_name,
- const char *data);
-extern char *retrieve_full_path(struct event *ev, const char *data);
-
-
-extern struct filename_plus_event *initialize_filename_plus_event(void);
-extern void free_filename_plus_event(struct filename_plus_event *fpe);
-
-
-extern struct event_list *initialize_event_list(void);
-extern int append_event_to_event_list(struct event_list *ev_list,
- struct event *ev);
-extern int add_non_existing_event_to_event_list(struct event_list *ev_list,
- struct event *ev);
-extern struct event_list *copy_event_list(struct event_list *el);
-extern int find_event(struct event *ev, struct event_list *el);
-extern void free_event_list(struct event_list *el);
-
-
-extern struct dim_structure *initialize_dim_structure(void);
-extern struct dim_structure *default_dim_structure(void);
-extern int set_dim_structure_entry(struct dim_structure *hsd,
- int dim_entry, const char *val_string);
-extern void free_dim_structure_entry(struct dim_structure *hsd);
-extern void free_dim_structure(struct dim_structure *hsd);
-
-#endif /* EVENTS_H */
diff --git a/libcrystfel/src/image-cbf.c b/libcrystfel/src/image-cbf.c
index c79b5e70..d2d0eca1 100644
--- a/libcrystfel/src/image-cbf.c
+++ b/libcrystfel/src/image-cbf.c
@@ -36,7 +36,6 @@
#include "image.h"
#include "utils.h"
-#include "events.h"
#include "detgeom.h"
#include "datatemplate.h"
diff --git a/libcrystfel/src/image-hdf5.c b/libcrystfel/src/image-hdf5.c
index 58541574..9a7b17ce 100644
--- a/libcrystfel/src/image-hdf5.c
+++ b/libcrystfel/src/image-hdf5.c
@@ -37,7 +37,6 @@
#include "image.h"
#include "utils.h"
-#include "events.h"
#include "detgeom.h"
#include "datatemplate.h"
diff --git a/libcrystfel/src/image-msgpack.c b/libcrystfel/src/image-msgpack.c
index 751c2a09..c4f0ffe4 100644
--- a/libcrystfel/src/image-msgpack.c
+++ b/libcrystfel/src/image-msgpack.c
@@ -40,7 +40,6 @@
#include <zmq.h>
#include <msgpack.h>
-#include <events.h>
#include <image.h>
#include <utils.h>
#include <msgpack.h>
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index a7f15e0d..6eb6bb11 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -36,7 +36,6 @@
#include "image.h"
#include "utils.h"
-#include "events.h"
#include "detgeom.h"
#include "image-hdf5.h"
#include "image-cbf.h"
diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h
index d2992b0f..93b41c34 100644
--- a/libcrystfel/src/image.h
+++ b/libcrystfel/src/image.h
@@ -47,7 +47,6 @@ struct image;
#include "reflist.h"
#include "crystal.h"
#include "index.h"
-#include "events.h"
#include "spectrum.h"
#include "datatemplate.h"
@@ -190,7 +189,6 @@ extern void free_all_crystals(struct image *image);
extern void mark_resolution_range_as_bad(struct image *image,
double min, double max);
-/* New API */
extern struct image *image_new(void);
extern struct image *image_read(DataTemplate *dtempl, const char *filename,
const char *event);
@@ -201,8 +199,8 @@ extern ImageFeatureList *image_read_peaks(const DataTemplate *dtempl,
const char *event,
int half_pixel_shift);
-extern struct event_list *image_expand_frames(const DataTemplate *dtempl,
- const char *filename);
+extern char **image_expand_frames(const DataTemplate *dtempl,
+ const char *filename, int *nframes);
#ifdef __cplusplus
}
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 8c40fa91..753ceb82 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -58,8 +58,6 @@
#include <sys/time.h>
#endif
-#include <events.h>
-
#include "im-sandbox.h"
#include "process_image.h"
#include "time-accounts.h"
diff --git a/src/im-zmq.c b/src/im-zmq.c
index 34b99c24..8ab899cc 100644
--- a/src/im-zmq.c
+++ b/src/im-zmq.c
@@ -40,7 +40,6 @@
#include <zmq.h>
#include <msgpack.h>
-#include <events.h>
#include <image.h>
#include <utils.h>
diff --git a/src/list_events.c b/src/list_events.c
index fc3d3411..84465dc5 100644
--- a/src/list_events.c
+++ b/src/list_events.c
@@ -154,26 +154,28 @@ int main(int argc, char *argv[])
rval = fgets(filename, 1024, ifh);
if ( rval != NULL ) {
- struct event_list *evlist;
+ char **evlist;
+ int num_events;
chomp(filename);
- evlist = image_expand_frames(dtempl, filename);
+ evlist = image_expand_frames(dtempl, filename,
+ &num_events);
if ( evlist == NULL ) {
ERROR("Failed to read %s\n", filename);
return 1;
}
- for ( i=0; i<evlist->num_events; i++ ) {
- char *str = get_event_string(evlist->events[i]);
- fprintf(ofh, "%s %s\n", filename, str);
- free(str);
+ for ( i=0; i<num_events; i++ ) {
+ fprintf(ofh, "%s %s\n",
+ filename, evlist[i]);
+ free(evlist[i]);
}
- STATUS("%i events found in %s\n", evlist->num_events,
- filename);
+ STATUS("%i events found in %s\n",
+ num_events, filename);
- free_event_list(evlist);
+ free(evlist);
}