From e5d6699bce9722c516eb8ecd8ce56a563b554117 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Thu, 24 Nov 2016 17:40:00 +1000 Subject: [PATCH] * sources/* : add const on errcb arg --- src/sources/files.c | 6 +++--- src/sources/mcast.c | 6 +++--- src/sources/portknock.c | 6 +++--- src/sources/source.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/sources/files.c b/src/sources/files.c index b3cf32a..6b208e7 100644 --- a/src/sources/files.c +++ b/src/sources/files.c @@ -23,13 +23,13 @@ typedef struct f2b_file_t { struct _config { char path[256]; char error[256]; - void (*errcb)(char *errstr); + void (*errcb)(const char *errstr); f2b_file_t *files; f2b_file_t *current; }; static void -errcb_stub(char *str) { +errcb_stub(const char *str) { assert(str != NULL); (void)(str); } @@ -146,7 +146,7 @@ error(cfg_t *cfg) { } void -errcb(cfg_t *cfg, void (*cb)(char *errstr)) { +errcb(cfg_t *cfg, void (*cb)(const char *errstr)) { assert(cfg != NULL); assert(cb != NULL); diff --git a/src/sources/mcast.c b/src/sources/mcast.c index a8b042c..64abd8a 100644 --- a/src/sources/mcast.c +++ b/src/sources/mcast.c @@ -21,7 +21,7 @@ struct _config { char name[32]; char error[256]; - void (*errcb)(char *errstr); + void (*errcb)(const char *errstr); char baddr[INET6_ADDRSTRLEN]; /**< bind address */ char maddr[INET_ADDRSTRLEN]; /**< multicast address */ char mport[6]; /**< multicast port */ @@ -30,7 +30,7 @@ struct _config { }; static void -errcb_stub(char *str) { +errcb_stub(const char *str) { assert(str != NULL); (void)(str); } @@ -97,7 +97,7 @@ error(cfg_t *cfg) { } void -errcb(cfg_t *cfg, void (*cb)(char *errstr)) { +errcb(cfg_t *cfg, void (*cb)(const char *errstr)) { assert(cfg != NULL); assert(cb != NULL); diff --git a/src/sources/portknock.c b/src/sources/portknock.c index a5d37cb..4a23095 100644 --- a/src/sources/portknock.c +++ b/src/sources/portknock.c @@ -26,13 +26,13 @@ typedef struct f2b_port_t { struct _config { char name[32]; char error[256]; - void (*errcb)(char *errstr); + void (*errcb)(const char *errstr); f2b_port_t *ports; f2b_port_t *current; }; static void -errcb_stub(char *str) { +errcb_stub(const char *str) { assert(str != NULL); (void)(str); } @@ -124,7 +124,7 @@ error(cfg_t *cfg) { } void -errcb(cfg_t *cfg, void (*cb)(char *errstr)) { +errcb(cfg_t *cfg, void (*cb)(const char *errstr)) { assert(cfg != NULL); assert(cb != NULL); diff --git a/src/sources/source.h b/src/sources/source.h index 5d012ac..566ed16 100644 --- a/src/sources/source.h +++ b/src/sources/source.h @@ -104,7 +104,7 @@ extern char *error(cfg_t *cfg); * @param cb Error callback * @note Optional, if this function is not called, processing errors will be suppressed */ -extern void errcb(cfg_t *cfg, void (*cb)(char *errstr)); +extern void errcb(cfg_t *cfg, void (*cb)(const char *errstr)); /** * @brief Allocate resources and start processing * @param cfg Module handler