confd: Use printf attribute on relevant helpers

This let's the compiler catch format-specifier-to-argument mismatches.
This commit is contained in:
Tobias Waldekranz
2023-05-12 14:24:41 +02:00
committed by Joachim Wiberg
parent 31d5dbda8c
commit 3ae4e1d9ca
2 changed files with 15 additions and 7 deletions
+6 -3
View File
@@ -3,9 +3,12 @@
#ifndef CONFD_HELPERS_H_
#define CONFD_HELPERS_H_
FILE *popenf(const char *type, const char *cmdf, ...);
FILE *popenf(const char *type, const char *cmdf, ...)
__attribute__ ((format (printf, 2, 3)));
int writedf(int value, const char *fmt, ...);
int writesf(const char *str, const char *fmt, ...);
int writedf(int value, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
int writesf(const char *str, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
#endif /* CONFD_HELPERS_H_ */
+9 -4
View File
@@ -11,9 +11,14 @@
int srx_set_item(sr_session_ctx_t *session, const sr_val_t *val, sr_edit_options_t opts,
const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
char *srx_get_str (sr_session_ctx_t *session, const char *fmt, ...);
int srx_get_int (sr_session_ctx_t *session, int *result, sr_val_type_t type, const char *fmt, ...);
int srx_get_bool (sr_session_ctx_t *session, const char *fmt, ...);
int srx_enabled (sr_session_ctx_t *session, const char *fmt, ...);
char *srx_get_str (sr_session_ctx_t *session, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
int srx_get_int (sr_session_ctx_t *session, int *result, sr_val_type_t type, const char *fmt, ...)
__attribute__ ((format (printf, 4, 5)));
int srx_get_bool (sr_session_ctx_t *session, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
int srx_enabled (sr_session_ctx_t *session, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
#endif /* CONFD_SRX_VAL_H_ */