From 38ebc3afce88a250751a8c8fad01881b2b09f771 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 21 Mar 2023 09:54:28 +0100 Subject: [PATCH] Protect return value with USE_RET --- src/emu/pv/cfg.h | 4 +++- src/emu/pv/pcf.h | 13 +++++++------ src/emu/pv/prf.h | 7 ++++--- src/emu/pv/prv.h | 10 +++++----- src/emu/pv/pvt.h | 12 ++++++------ src/emu/recorder.c | 5 ++++- src/emu/stream.h | 2 +- 7 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/emu/pv/cfg.h b/src/emu/pv/cfg.h index a6018f0..a05bed3 100644 --- a/src/emu/pv/cfg.h +++ b/src/emu/pv/cfg.h @@ -4,6 +4,8 @@ #ifndef CFG_H #define CFG_H -int cfg_generate(const char *tracedir); +#include "common.h" + +USE_RET int cfg_generate(const char *tracedir); #endif /* CFG_H */ diff --git a/src/emu/pv/pcf.h b/src/emu/pv/pcf.h index 24967ce..e5c9c43 100644 --- a/src/emu/pv/pcf.h +++ b/src/emu/pv/pcf.h @@ -4,6 +4,7 @@ #ifndef PCF_H #define PCF_H +#include "common.h" #include "uthash.h" #include @@ -41,12 +42,12 @@ struct pcf_value_label { char *label; }; -int pcf_open(struct pcf *pcf, char *path); -int pcf_close(struct pcf *pcf); +USE_RET int pcf_open(struct pcf *pcf, char *path); +USE_RET int pcf_close(struct pcf *pcf); -struct pcf_type *pcf_find_type(struct pcf *pcf, int type_id); -struct pcf_type *pcf_add_type(struct pcf *pcf, int type_id, const char *label); -struct pcf_value *pcf_add_value(struct pcf_type *type, int value, const char *label); -struct pcf_value *pcf_find_value(struct pcf_type *type, int value); +USE_RET struct pcf_type *pcf_find_type(struct pcf *pcf, int type_id); +USE_RET struct pcf_type *pcf_add_type(struct pcf *pcf, int type_id, const char *label); +USE_RET struct pcf_value *pcf_add_value(struct pcf_type *type, int value, const char *label); +USE_RET struct pcf_value *pcf_find_value(struct pcf_type *type, int value); #endif /* PCF_H */ diff --git a/src/emu/pv/prf.h b/src/emu/pv/prf.h index d9101ff..5ae1206 100644 --- a/src/emu/pv/prf.h +++ b/src/emu/pv/prf.h @@ -4,6 +4,7 @@ #ifndef PRF_H #define PRF_H +#include "common.h" #include #define MAX_PRF_LABEL 512 @@ -19,9 +20,9 @@ struct prf { struct prf_row *rows; }; -int prf_open(struct prf *prf, const char *path, long nrows); -int prf_add(struct prf *prf, long index, const char *name); -int prf_close(struct prf *prf); +USE_RET int prf_open(struct prf *prf, const char *path, long nrows); +USE_RET int prf_add(struct prf *prf, long index, const char *name); +USE_RET int prf_close(struct prf *prf); #endif /* PRF_H */ diff --git a/src/emu/pv/prv.h b/src/emu/pv/prv.h index b289729..f45375c 100644 --- a/src/emu/pv/prv.h +++ b/src/emu/pv/prv.h @@ -37,10 +37,10 @@ struct prv { struct prv_chan *channels; }; -int prv_open(struct prv *prv, long nrows, const char *path); -int prv_open_file(struct prv *prv, long nrows, FILE *file); -int prv_register(struct prv *prv, long row, long type, struct bay *bay, struct chan *chan, long flags); -int prv_advance(struct prv *prv, int64_t time); -int prv_close(struct prv *prv); +USE_RET int prv_open(struct prv *prv, long nrows, const char *path); +USE_RET int prv_open_file(struct prv *prv, long nrows, FILE *file); +USE_RET int prv_register(struct prv *prv, long row, long type, struct bay *bay, struct chan *chan, long flags); +USE_RET int prv_advance(struct prv *prv, int64_t time); +USE_RET int prv_close(struct prv *prv); #endif /* PRV_H */ diff --git a/src/emu/pv/pvt.h b/src/emu/pv/pvt.h index 6ba40fc..ade1c49 100644 --- a/src/emu/pv/pvt.h +++ b/src/emu/pv/pvt.h @@ -20,11 +20,11 @@ struct pvt { struct UT_hash_handle hh; /* For recorder */ }; -int pvt_open(struct pvt *pvt, long nrows, const char *dir, const char *name); -struct prv *pvt_get_prv(struct pvt *pvt); -struct pcf *pvt_get_pcf(struct pvt *pvt); -struct prf *pvt_get_prf(struct pvt *pvt); -int pvt_advance(struct pvt *pvt, int64_t time); -int pvt_close(struct pvt *pvt); +USE_RET int pvt_open(struct pvt *pvt, long nrows, const char *dir, const char *name); +USE_RET struct prv *pvt_get_prv(struct pvt *pvt); +USE_RET struct pcf *pvt_get_pcf(struct pvt *pvt); +USE_RET struct prf *pvt_get_prf(struct pvt *pvt); +USE_RET int pvt_advance(struct pvt *pvt, int64_t time); +USE_RET int pvt_close(struct pvt *pvt); #endif /* PVT_H */ diff --git a/src/emu/recorder.c b/src/emu/recorder.c index e791286..411fd5a 100644 --- a/src/emu/recorder.c +++ b/src/emu/recorder.c @@ -80,7 +80,10 @@ recorder_finish(struct recorder *rec) } /* TODO: Use configs per pvt */ - cfg_generate(rec->dir); /* Ignore error */ + if (cfg_generate(rec->dir) != 0) { + err("cfg_generate failed"); + /* Ignore error */ + } return 0; } diff --git a/src/emu/stream.h b/src/emu/stream.h index 65d365e..e0ce36b 100644 --- a/src/emu/stream.h +++ b/src/emu/stream.h @@ -45,6 +45,6 @@ USE_RET int64_t stream_evclock(struct stream *stream, struct ovni_ev *ev); USE_RET int64_t stream_lastclock(struct stream *stream); void stream_allow_unsorted(struct stream *stream); void stream_data_set(struct stream *stream, void *data); - void *stream_data_get(struct stream *stream); +USE_RET void *stream_data_get(struct stream *stream); #endif /* STREAM_H */