mirror of
https://github.com/haproxy/haproxy.git
synced 2026-06-12 10:20:00 -04:00
MINOR: chunk: make chunk_initstr() take a const string
chunk_initstr() prepares a read-only chunk from a string of fixed length. Thus it must be prepared to accept a read-only string on the input, otherwise the caller has to force-cast some const char* and that's not a good idea.
This commit is contained in:
parent
601360b41d
commit
70af633ebe
1 changed files with 3 additions and 2 deletions
|
|
@ -77,9 +77,10 @@ static inline int chunk_initlen(struct chunk *chk, char *str, size_t size, int l
|
|||
return 1;
|
||||
}
|
||||
|
||||
static inline void chunk_initstr(struct chunk *chk, char *str)
|
||||
/* this is only for temporary manipulation, the chunk is read-only */
|
||||
static inline void chunk_initstr(struct chunk *chk, const char *str)
|
||||
{
|
||||
chk->str = str;
|
||||
chk->str = (char *)str;
|
||||
chk->len = strlen(str);
|
||||
chk->size = 0; /* mark it read-only */
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue