service: constify function arguments
authorFelix Fietkau <nbd@openwrt.org>
Tue, 3 Jun 2014 22:19:28 +0000 (00:19 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 3 Jun 2014 22:21:12 +0000 (00:21 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
service.c
service.h

index 9d3f084..049de52 100644 (file)
--- a/service.c
+++ b/service.c
@@ -70,8 +70,8 @@ char *hostname = NULL;
 static char *sdudp =  "_services._dns-sd._udp.local";
 static char *sdtcp =  "_services._dns-sd._tcp.local";
 
-char*
-service_name(char *domain)
+char *
+service_name(const char *domain)
 {
        static char buffer[256];
 
@@ -84,7 +84,7 @@ static void
 service_send_ptr(struct uloop_fd *u, struct service *s)
 {
        unsigned char buffer[MAX_NAME_LEN];
-       char *host = service_name(s->service);
+       const char *host = service_name(s->service);
        int len = dn_comp(host, buffer, MAX_NAME_LEN, NULL, NULL);
 
        if (len < 1)
@@ -173,7 +173,7 @@ service_reply_a(struct uloop_fd *u, int type)
 }
 
 void
-service_reply(struct uloop_fd *u, char *match)
+service_reply(struct uloop_fd *u, const char *match)
 {
        struct service *s;
 
@@ -209,7 +209,7 @@ service_reply(struct uloop_fd *u, char *match)
 }
 
 void
-service_announce_services(struct uloop_fd *u, char *service)
+service_announce_services(struct uloop_fd *u, const char *service)
 {
        struct service *s;
        int tcp = 1;
index a8937a7..7dd0ff1 100644 (file)
--- a/service.h
+++ b/service.h
 #define _SERVICE_H__
 
 extern char *hostname;
-extern char* service_name(char *domain);
+extern char *service_name(const char *domain);
 extern void service_init(void);
 extern void service_cleanup(void);
 extern void service_announce(struct uloop_fd *u);
-extern void service_announce_services(struct uloop_fd *u, char *service);
-extern void service_reply(struct uloop_fd *u, char *match);
+extern void service_announce_services(struct uloop_fd *u, const char *service);
+extern void service_reply(struct uloop_fd *u, const char *match);
 extern void service_reply_a(struct uloop_fd *u, int type);
 
 #endif