Browse Source

* sources/* : add const on errcb arg

master
Alex 'AdUser' Z 8 years ago
parent
commit
e5d6699bce
  1. 6
      src/sources/files.c
  2. 6
      src/sources/mcast.c
  3. 6
      src/sources/portknock.c
  4. 2
      src/sources/source.h

6
src/sources/files.c

@ -23,13 +23,13 @@ typedef struct f2b_file_t {
struct _config { struct _config {
char path[256]; char path[256];
char error[256]; char error[256];
void (*errcb)(char *errstr); void (*errcb)(const char *errstr);
f2b_file_t *files; f2b_file_t *files;
f2b_file_t *current; f2b_file_t *current;
}; };
static void static void
errcb_stub(char *str) { errcb_stub(const char *str) {
assert(str != NULL); assert(str != NULL);
(void)(str); (void)(str);
} }
@ -146,7 +146,7 @@ error(cfg_t *cfg) {
} }
void void
errcb(cfg_t *cfg, void (*cb)(char *errstr)) { errcb(cfg_t *cfg, void (*cb)(const char *errstr)) {
assert(cfg != NULL); assert(cfg != NULL);
assert(cb != NULL); assert(cb != NULL);

6
src/sources/mcast.c

@ -21,7 +21,7 @@
struct _config { struct _config {
char name[32]; char name[32];
char error[256]; char error[256];
void (*errcb)(char *errstr); void (*errcb)(const char *errstr);
char baddr[INET6_ADDRSTRLEN]; /**< bind address */ char baddr[INET6_ADDRSTRLEN]; /**< bind address */
char maddr[INET_ADDRSTRLEN]; /**< multicast address */ char maddr[INET_ADDRSTRLEN]; /**< multicast address */
char mport[6]; /**< multicast port */ char mport[6]; /**< multicast port */
@ -30,7 +30,7 @@ struct _config {
}; };
static void static void
errcb_stub(char *str) { errcb_stub(const char *str) {
assert(str != NULL); assert(str != NULL);
(void)(str); (void)(str);
} }
@ -97,7 +97,7 @@ error(cfg_t *cfg) {
} }
void void
errcb(cfg_t *cfg, void (*cb)(char *errstr)) { errcb(cfg_t *cfg, void (*cb)(const char *errstr)) {
assert(cfg != NULL); assert(cfg != NULL);
assert(cb != NULL); assert(cb != NULL);

6
src/sources/portknock.c

@ -26,13 +26,13 @@ typedef struct f2b_port_t {
struct _config { struct _config {
char name[32]; char name[32];
char error[256]; char error[256];
void (*errcb)(char *errstr); void (*errcb)(const char *errstr);
f2b_port_t *ports; f2b_port_t *ports;
f2b_port_t *current; f2b_port_t *current;
}; };
static void static void
errcb_stub(char *str) { errcb_stub(const char *str) {
assert(str != NULL); assert(str != NULL);
(void)(str); (void)(str);
} }
@ -124,7 +124,7 @@ error(cfg_t *cfg) {
} }
void void
errcb(cfg_t *cfg, void (*cb)(char *errstr)) { errcb(cfg_t *cfg, void (*cb)(const char *errstr)) {
assert(cfg != NULL); assert(cfg != NULL);
assert(cb != NULL); assert(cb != NULL);

2
src/sources/source.h

@ -104,7 +104,7 @@ extern char *error(cfg_t *cfg);
* @param cb Error callback * @param cb Error callback
* @note Optional, if this function is not called, processing errors will be suppressed * @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 * @brief Allocate resources and start processing
* @param cfg Module handler * @param cfg Module handler

Loading…
Cancel
Save