Protect return value with USE_RET

This commit is contained in:
Rodrigo Arias 2023-03-21 09:54:28 +01:00 committed by Rodrigo Arias Mallo
parent fb95abcc25
commit 38ebc3afce
7 changed files with 30 additions and 23 deletions

View File

@ -4,6 +4,8 @@
#ifndef CFG_H #ifndef CFG_H
#define 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 */ #endif /* CFG_H */

View File

@ -4,6 +4,7 @@
#ifndef PCF_H #ifndef PCF_H
#define PCF_H #define PCF_H
#include "common.h"
#include "uthash.h" #include "uthash.h"
#include <stdio.h> #include <stdio.h>
@ -41,12 +42,12 @@ struct pcf_value_label {
char *label; char *label;
}; };
int pcf_open(struct pcf *pcf, char *path); USE_RET int pcf_open(struct pcf *pcf, char *path);
int pcf_close(struct pcf *pcf); USE_RET int pcf_close(struct pcf *pcf);
struct pcf_type *pcf_find_type(struct pcf *pcf, int type_id); USE_RET 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); USE_RET 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); USE_RET 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_value *pcf_find_value(struct pcf_type *type, int value);
#endif /* PCF_H */ #endif /* PCF_H */

View File

@ -4,6 +4,7 @@
#ifndef PRF_H #ifndef PRF_H
#define PRF_H #define PRF_H
#include "common.h"
#include <stdio.h> #include <stdio.h>
#define MAX_PRF_LABEL 512 #define MAX_PRF_LABEL 512
@ -19,9 +20,9 @@ struct prf {
struct prf_row *rows; struct prf_row *rows;
}; };
int prf_open(struct prf *prf, const char *path, long nrows); USE_RET int prf_open(struct prf *prf, const char *path, long nrows);
int prf_add(struct prf *prf, long index, const char *name); USE_RET int prf_add(struct prf *prf, long index, const char *name);
int prf_close(struct prf *prf); USE_RET int prf_close(struct prf *prf);
#endif /* PRF_H */ #endif /* PRF_H */

View File

@ -37,10 +37,10 @@ struct prv {
struct prv_chan *channels; struct prv_chan *channels;
}; };
int prv_open(struct prv *prv, long nrows, const char *path); USE_RET int prv_open(struct prv *prv, long nrows, const char *path);
int prv_open_file(struct prv *prv, long nrows, FILE *file); USE_RET 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); USE_RET 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); USE_RET int prv_advance(struct prv *prv, int64_t time);
int prv_close(struct prv *prv); USE_RET int prv_close(struct prv *prv);
#endif /* PRV_H */ #endif /* PRV_H */

View File

@ -20,11 +20,11 @@ struct pvt {
struct UT_hash_handle hh; /* For recorder */ struct UT_hash_handle hh; /* For recorder */
}; };
int pvt_open(struct pvt *pvt, long nrows, const char *dir, const char *name); USE_RET int pvt_open(struct pvt *pvt, long nrows, const char *dir, const char *name);
struct prv *pvt_get_prv(struct pvt *pvt); USE_RET struct prv *pvt_get_prv(struct pvt *pvt);
struct pcf *pvt_get_pcf(struct pvt *pvt); USE_RET struct pcf *pvt_get_pcf(struct pvt *pvt);
struct prf *pvt_get_prf(struct pvt *pvt); USE_RET struct prf *pvt_get_prf(struct pvt *pvt);
int pvt_advance(struct pvt *pvt, int64_t time); USE_RET int pvt_advance(struct pvt *pvt, int64_t time);
int pvt_close(struct pvt *pvt); USE_RET int pvt_close(struct pvt *pvt);
#endif /* PVT_H */ #endif /* PVT_H */

View File

@ -80,7 +80,10 @@ recorder_finish(struct recorder *rec)
} }
/* TODO: Use configs per pvt */ /* 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; return 0;
} }

View File

@ -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); USE_RET int64_t stream_lastclock(struct stream *stream);
void stream_allow_unsorted(struct stream *stream); void stream_allow_unsorted(struct stream *stream);
void stream_data_set(struct stream *stream, void *data); 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 */ #endif /* STREAM_H */