CLEANUP: log: make the low_level lf_{ip,port,text,text_len} functions take consts
These ones were abusively relying on variables making it hard to integrate
with const arguments.
diff --git a/include/proto/log.h b/include/proto/log.h
index 3e17733..419e0b3 100644
--- a/include/proto/log.h
+++ b/include/proto/log.h
@@ -150,19 +150,19 @@
*
* Return the adress of the \0 character, or NULL on error
*/
-char *lf_text_len(char *dst, const char *src, size_t len, size_t size, struct logformat_node *node);
+char *lf_text_len(char *dst, const const char *src, size_t len, size_t size, const struct logformat_node *node);
/*
* Write a IP adress to the log string
* +X option write in hexadecimal notation, most signifant byte on the left
*/
-char *lf_ip(char *dst, struct sockaddr *sockaddr, size_t size, struct logformat_node *node);
+char *lf_ip(char *dst, const struct sockaddr *sockaddr, size_t size, const struct logformat_node *node);
/*
* Write a port to the log
* +X option write in hexadecimal notation, most signifant byte on the left
*/
-char *lf_port(char *dst, struct sockaddr *sockaddr, size_t size, struct logformat_node *node);
+char *lf_port(char *dst, const struct sockaddr *sockaddr, size_t size, const struct logformat_node *node);
#endif /* _PROTO_LOG_H */
diff --git a/src/log.c b/src/log.c
index dfac121..0c5e1f9 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1053,7 +1053,7 @@
*
* Return the adress of the \0 character, or NULL on error
*/
-char *lf_text_len(char *dst, const char *src, size_t len, size_t size, struct logformat_node *node)
+char *lf_text_len(char *dst, const char *src, size_t len, size_t size, const struct logformat_node *node)
{
if (size < 2)
return NULL;
@@ -1097,7 +1097,7 @@
return dst;
}
-static inline char *lf_text(char *dst, const char *src, size_t size, struct logformat_node *node)
+static inline char *lf_text(char *dst, const char *src, size_t size, const struct logformat_node *node)
{
return lf_text_len(dst, src, size, size, node);
}
@@ -1106,7 +1106,7 @@
* Write a IP adress to the log string
* +X option write in hexadecimal notation, most signifant byte on the left
*/
-char *lf_ip(char *dst, struct sockaddr *sockaddr, size_t size, struct logformat_node *node)
+char *lf_ip(char *dst, const struct sockaddr *sockaddr, size_t size, const struct logformat_node *node)
{
char *ret = dst;
int iret;
@@ -1131,7 +1131,7 @@
* Write a port to the log
* +X option write in hexadecimal notation, most signifant byte on the left
*/
-char *lf_port(char *dst, struct sockaddr *sockaddr, size_t size, struct logformat_node *node)
+char *lf_port(char *dst, const struct sockaddr *sockaddr, size_t size, const struct logformat_node *node)
{
char *ret = dst;
int iret;