const pointers
The usual bunch of pointer arguments which should be const.
This commit is contained in:
@@ -234,7 +234,7 @@ static void closeInterface(Interface * interface)
|
|||||||
SECURE("interface %i: closed\n", interface->num);
|
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;
|
unsigned int i;
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ void openAInterface(int fd, struct sockaddr *addr)
|
|||||||
switch (addr->sa_family) {
|
switch (addr->sa_family) {
|
||||||
#ifdef HAVE_TCP
|
#ifdef HAVE_TCP
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
hostname = (const char *)inet_ntoa(((struct sockaddr_in *)
|
hostname = (const char *)inet_ntoa(((const struct sockaddr_in *)
|
||||||
addr)->sin_addr);
|
addr)->sin_addr);
|
||||||
if (!hostname)
|
if (!hostname)
|
||||||
hostname = "error getting ipv4 address";
|
hostname = "error getting ipv4 address";
|
||||||
@@ -259,8 +259,8 @@ void openAInterface(int fd, struct sockaddr *addr)
|
|||||||
{
|
{
|
||||||
static char host[INET6_ADDRSTRLEN + 1];
|
static char host[INET6_ADDRSTRLEN + 1];
|
||||||
memset(host, 0, INET6_ADDRSTRLEN + 1);
|
memset(host, 0, INET6_ADDRSTRLEN + 1);
|
||||||
if (inet_ntop(AF_INET6, (void *)
|
if (inet_ntop(AF_INET6, (const void *)
|
||||||
&(((struct sockaddr_in6 *)addr)->
|
&(((const struct sockaddr_in6 *)addr)->
|
||||||
sin6_addr), host,
|
sin6_addr), host,
|
||||||
INET6_ADDRSTRLEN)) {
|
INET6_ADDRSTRLEN)) {
|
||||||
hostname = (const char *)host;
|
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;
|
static unsigned int i;
|
||||||
size_t copylen;
|
size_t copylen;
|
||||||
|
@@ -22,10 +22,10 @@
|
|||||||
#include "os_compat.h"
|
#include "os_compat.h"
|
||||||
|
|
||||||
void initInterfaces(void);
|
void initInterfaces(void);
|
||||||
void openAInterface(int fd, struct sockaddr *addr);
|
void openAInterface(int fd, const struct sockaddr *addr);
|
||||||
void freeAllInterfaces(void);
|
void freeAllInterfaces(void);
|
||||||
void closeOldInterfaces(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);
|
int doIOForInterfaces(void);
|
||||||
|
|
||||||
|
@@ -34,22 +34,22 @@ struct strnode *new_strnode(char *s)
|
|||||||
return x;
|
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);
|
struct strnode *x = xmalloc(sizeof(struct strnode) + size);
|
||||||
x->next = NULL;
|
x->next = NULL;
|
||||||
x->data = ((char *)x + sizeof(struct strnode));
|
x->data = ((char *)x + sizeof(struct strnode));
|
||||||
memcpy((void *)x->data, (void*)s, size);
|
memcpy((void *)x->data, (const void*)s, size);
|
||||||
return x;
|
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);
|
struct sllnode *x = xmalloc(sizeof(struct sllnode) + size);
|
||||||
x->next = NULL;
|
x->next = NULL;
|
||||||
x->size = size;
|
x->size = size;
|
||||||
x->data = ((char *)x + sizeof(struct sllnode));
|
x->data = ((char *)x + sizeof(struct sllnode));
|
||||||
memcpy(x->data, (void *)s, size);
|
memcpy(x->data, (const void *)s, size);
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,11 +42,11 @@ struct sllnode {
|
|||||||
|
|
||||||
struct strnode *new_strnode(char *s);
|
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 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 */
|
#endif /* SLLIST_H */
|
||||||
|
@@ -697,7 +697,7 @@ int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void appendToTagItems(MpdTag * tag, enum tag_type type,
|
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;
|
unsigned int i = tag->numOfItems;
|
||||||
char *duplicated = xmalloc(len + 1);
|
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,
|
void addItemToMpdTagWithLen(MpdTag * tag, enum tag_type itemType,
|
||||||
char *value, size_t len)
|
const char *value, size_t len)
|
||||||
{
|
{
|
||||||
if (ignoreTagItems[itemType])
|
if (ignoreTagItems[itemType])
|
||||||
{
|
{
|
||||||
|
@@ -73,7 +73,7 @@ void clearItemsFromMpdTag(MpdTag * tag, enum tag_type itemType);
|
|||||||
void freeMpdTag(MpdTag * tag);
|
void freeMpdTag(MpdTag * tag);
|
||||||
|
|
||||||
void addItemToMpdTagWithLen(MpdTag * tag, enum tag_type itemType,
|
void addItemToMpdTagWithLen(MpdTag * tag, enum tag_type itemType,
|
||||||
char *value, size_t len);
|
const char *value, size_t len);
|
||||||
|
|
||||||
#define addItemToMpdTag(tag, itemType, value) \
|
#define addItemToMpdTag(tag, itemType, value) \
|
||||||
addItemToMpdTagWithLen(tag, itemType, value, strlen(value))
|
addItemToMpdTagWithLen(tag, itemType, value, strlen(value))
|
||||||
|
Reference in New Issue
Block a user