aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-03-07 21:06:42 +0100
committerGravatar Christian Hesse <mail@eworm.de>2018-03-07 21:06:42 +0100
commit6136f6fb330c9f6d7cd0d90134893ee99f575fea (patch)
treed8c0dbae7696ed43f9f27c5fd32b07558f1ad294
parentda27651dbf911cda2be30bf817194ff8d7329094 (diff)
downloadnetlink-notify-6136f6fb330c9f6d7cd0d90134893ee99f575fea.tar.gz
netlink-notify-6136f6fb330c9f6d7cd0d90134893ee99f575fea.tar.zst
make more parameters const
-rw-r--r--netlink-notify.c14
-rw-r--r--netlink-notify.h14
2 files changed, 14 insertions, 14 deletions
diff --git a/netlink-notify.c b/netlink-notify.c
index 3228364..c9db485 100644
--- a/netlink-notify.c
+++ b/netlink-notify.c
@@ -37,7 +37,7 @@ void free_addresses(struct addresses_seen *addresses_seen) {
}
/*** add_address ***/
-struct addresses_seen * add_address(struct addresses_seen *addresses_seen, const char *address, unsigned char prefix) {
+struct addresses_seen * add_address(struct addresses_seen *addresses_seen, const char *address, const unsigned char prefix) {
struct addresses_seen *first = addresses_seen;
if (addresses_seen == NULL) {
@@ -63,7 +63,7 @@ struct addresses_seen * add_address(struct addresses_seen *addresses_seen, const
}
/*** remove_address ***/
-struct addresses_seen * remove_address(struct addresses_seen *addresses_seen, const char *address, unsigned char prefix) {
+struct addresses_seen * remove_address(struct addresses_seen *addresses_seen, const char *address, const unsigned char prefix) {
struct addresses_seen *first = addresses_seen, *last = NULL;
/* no addresses, just return NULL */
@@ -91,7 +91,7 @@ struct addresses_seen * remove_address(struct addresses_seen *addresses_seen, co
}
/*** match_address ***/
-int match_address(struct addresses_seen *addresses_seen, const char *address, unsigned char prefix) {
+int match_address(struct addresses_seen *addresses_seen, const char *address, const unsigned char prefix) {
while (addresses_seen != NULL) {
if (strcmp(addresses_seen->address, address) == 0 && addresses_seen->prefix == prefix) {
return 1;
@@ -102,7 +102,7 @@ int match_address(struct addresses_seen *addresses_seen, const char *address, un
}
/*** list_addresses ***/
-void list_addresses(struct addresses_seen *addresses_seen, char *interface) {
+void list_addresses(struct addresses_seen *addresses_seen, const char *interface) {
printf("%s: Addresses seen for interface %s:", program, interface);
while (addresses_seen != NULL) {
printf(" %s/%d", addresses_seen->address, addresses_seen->prefix);
@@ -130,7 +130,7 @@ void get_ssid(const char *interface, char *essid) {
}
/*** newstr_link ***/
-char * newstr_link(char *interface, unsigned int flags) {
+char * newstr_link(const char *interface, const unsigned int flags) {
char *notifystr, *e_interface = NULL, *e_essid = NULL;
char essid[IW_ESSID_MAX_SIZE + 1];
@@ -157,7 +157,7 @@ char * newstr_link(char *interface, unsigned int flags) {
}
/*** newstr_addr ***/
-char * newstr_addr(char *interface, unsigned char family, char *ipaddr, unsigned char prefix) {
+char * newstr_addr(const char *interface, const unsigned char family, const char *ipaddr, const unsigned char prefix) {
char *notifystr, *e_interface = NULL;
e_interface = g_markup_escape_text(interface, -1);
@@ -171,7 +171,7 @@ char * newstr_addr(char *interface, unsigned char family, char *ipaddr, unsigned
}
/*** newstr_away ***/
-char * newstr_away(char *interface) {
+char * newstr_away(const char *interface) {
char *notifystr, *e_interface = NULL;
e_interface = g_markup_escape_text(interface, -1);
diff --git a/netlink-notify.h b/netlink-notify.h
index ee61335..33d69fb 100644
--- a/netlink-notify.h
+++ b/netlink-notify.h
@@ -64,28 +64,28 @@ struct ifs {
void free_addresses(struct addresses_seen *addresses_seen);
/*** add_address ***/
-struct addresses_seen * add_address(struct addresses_seen *addresses_seen, const char *address, unsigned char prefix);
+struct addresses_seen * add_address(struct addresses_seen *addresses_seen, const char *address, const unsigned char prefix);
/*** remove_address ***/
-struct addresses_seen * remove_address(struct addresses_seen *addresses_seen, const char *address, unsigned char prefix);
+struct addresses_seen * remove_address(struct addresses_seen *addresses_seen, const char *address, const unsigned char prefix);
/*** match_address ***/
-int match_address(struct addresses_seen *addresses_seen, const char *address, unsigned char prefix);
+int match_address(struct addresses_seen *addresses_seen, const char *address, const unsigned char prefix);
/*** list_addresses ***/
-void list_addresses(struct addresses_seen *addresses_seen, char *interface);
+void list_addresses(struct addresses_seen *addresses_seen, const char *interface);
/*** get_ssid ***/
void get_ssid(const char *interface, char *essid);
/*** newstr_link ***/
-char * newstr_link(char *interface, unsigned int flags);
+char * newstr_link(const char *interface, const unsigned int flags);
/*** newstr_addr ***/
-char * newstr_addr(char *interface, unsigned char family, char *ipaddr, unsigned char prefix);
+char * newstr_addr(const char *interface, const unsigned char family, const char *ipaddr, const unsigned char prefix);
/*** newstr_away ***/
-char * newstr_away(char *interface);
+char * newstr_away(const char *interface);
/*** open_netlink ***/
int open_netlink (void);