aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-28 20:02:17 +0200
committerMax Kellermann <max@duempel.org>2008-08-28 20:02:17 +0200
commitbc1c8835c612ccb8063982657453fe658ed69d75 (patch)
tree192d420f193d8b5c6690d7064634ea58e3bc2d2d /src
parent801c71ed1c02a1505ef64902f6557fdfe1749a96 (diff)
downloadmpd-bc1c8835c612ccb8063982657453fe658ed69d75.tar.gz
mpd-bc1c8835c612ccb8063982657453fe658ed69d75.tar.xz
mpd-bc1c8835c612ccb8063982657453fe658ed69d75.zip
const pointers
The usual bunch of pointer arguments which should be const.
Diffstat (limited to 'src')
-rw-r--r--src/interface.c10
-rw-r--r--src/interface.h4
-rw-r--r--src/sllist.c8
-rw-r--r--src/sllist.h4
-rw-r--r--src/tag.c4
-rw-r--r--src/tag.h2
6 files changed, 16 insertions, 16 deletions
diff --git a/src/interface.c b/src/interface.c
index db5959f3a..ade2e36fc 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -234,7 +234,7 @@ static void closeInterface(Interface * interface)
SECURE("interface %i: closed\n", interface->num);
}
-void openAInterface(int fd, struct sockaddr *addr)
+void openAInterface(int fd, const struct sockaddr *addr)
{
unsigned int i;
@@ -249,7 +249,7 @@ void openAInterface(int fd, struct sockaddr *addr)
switch (addr->sa_family) {
#ifdef HAVE_TCP
case AF_INET:
- hostname = (const char *)inet_ntoa(((struct sockaddr_in *)
+ hostname = (const char *)inet_ntoa(((const struct sockaddr_in *)
addr)->sin_addr);
if (!hostname)
hostname = "error getting ipv4 address";
@@ -259,8 +259,8 @@ void openAInterface(int fd, struct sockaddr *addr)
{
static char host[INET6_ADDRSTRLEN + 1];
memset(host, 0, INET6_ADDRSTRLEN + 1);
- if (inet_ntop(AF_INET6, (void *)
- &(((struct sockaddr_in6 *)addr)->
+ if (inet_ntop(AF_INET6, (const void *)
+ &(((const struct sockaddr_in6 *)addr)->
sin6_addr), host,
INET6_ADDRSTRLEN)) {
hostname = (const char *)host;
@@ -689,7 +689,7 @@ static void flushInterfaceBuffer(Interface * interface)
}
}
-int interfacePrintWithFD(int fd, char *buffer, size_t buflen)
+int interfacePrintWithFD(int fd, const char *buffer, size_t buflen)
{
static unsigned int i;
size_t copylen;
diff --git a/src/interface.h b/src/interface.h
index a364f7922..c83381319 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -22,10 +22,10 @@
#include "os_compat.h"
void initInterfaces(void);
-void openAInterface(int fd, struct sockaddr *addr);
+void openAInterface(int fd, const struct sockaddr *addr);
void freeAllInterfaces(void);
void closeOldInterfaces(void);
-int interfacePrintWithFD(int fd, char *buffer, size_t len);
+int interfacePrintWithFD(int fd, const char *buffer, size_t len);
int doIOForInterfaces(void);
diff --git a/src/sllist.c b/src/sllist.c
index cfe392d60..0f4529fd3 100644
--- a/src/sllist.c
+++ b/src/sllist.c
@@ -34,22 +34,22 @@ struct strnode *new_strnode(char *s)
return x;
}
-struct strnode *new_strnode_dup(char *s, const size_t size)
+struct strnode *new_strnode_dup(const char *s, const size_t size)
{
struct strnode *x = xmalloc(sizeof(struct strnode) + size);
x->next = NULL;
x->data = ((char *)x + sizeof(struct strnode));
- memcpy((void *)x->data, (void*)s, size);
+ memcpy((void *)x->data, (const void*)s, size);
return x;
}
-struct sllnode *new_sllnode(void *s, const size_t size)
+struct sllnode *new_sllnode(const void *s, const size_t size)
{
struct sllnode *x = xmalloc(sizeof(struct sllnode) + size);
x->next = NULL;
x->size = size;
x->data = ((char *)x + sizeof(struct sllnode));
- memcpy(x->data, (void *)s, size);
+ memcpy(x->data, (const void *)s, size);
return x;
}
diff --git a/src/sllist.h b/src/sllist.h
index ba7d8ea95..e8cb8805d 100644
--- a/src/sllist.h
+++ b/src/sllist.h
@@ -42,11 +42,11 @@ struct sllnode {
struct strnode *new_strnode(char *s);
-struct strnode *new_strnode_dup(char *s, const size_t size);
+struct strnode *new_strnode_dup(const char *s, const size_t size);
struct strnode *dup_strlist(struct strnode *old);
-struct sllnode *new_sllnode(void *s, const size_t size);
+struct sllnode *new_sllnode(const void *s, const size_t size);
#endif /* SLLIST_H */
diff --git a/src/tag.c b/src/tag.c
index 00f09f10f..c1ccd0a42 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -697,7 +697,7 @@ int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2)
}
static void appendToTagItems(MpdTag * tag, enum tag_type type,
- char *value, size_t len)
+ const char *value, size_t len)
{
unsigned int i = tag->numOfItems;
char *duplicated = xmalloc(len + 1);
@@ -718,7 +718,7 @@ static void appendToTagItems(MpdTag * tag, enum tag_type type,
}
void addItemToMpdTagWithLen(MpdTag * tag, enum tag_type itemType,
- char *value, size_t len)
+ const char *value, size_t len)
{
if (ignoreTagItems[itemType])
{
diff --git a/src/tag.h b/src/tag.h
index 74770e49e..a9bf19934 100644
--- a/src/tag.h
+++ b/src/tag.h
@@ -73,7 +73,7 @@ void clearItemsFromMpdTag(MpdTag * tag, enum tag_type itemType);
void freeMpdTag(MpdTag * tag);
void addItemToMpdTagWithLen(MpdTag * tag, enum tag_type itemType,
- char *value, size_t len);
+ const char *value, size_t len);
#define addItemToMpdTag(tag, itemType, value) \
addItemToMpdTagWithLen(tag, itemType, value, strlen(value))