mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
parse_header: make the 2nd parameter point to const
In almost all calls to parse_header, the second argument is a string literal: parse_header(head, "Charset", NULL) for example. Of course, parse_header does not write to that string. Accordingly, make the parameter point to const, so calls that use a variable rather than a string literal can make that variable point to const too. Leaving the other parameters non-const for now.
This commit is contained in:
parent
f72cedf92d
commit
0386a3e14b
@ -116,14 +116,15 @@
|
|||||||
#define LWS(c) ((c) == ' ' || (c) == ASCII_TAB)
|
#define LWS(c) ((c) == ' ' || (c) == ASCII_TAB)
|
||||||
|
|
||||||
unsigned char *
|
unsigned char *
|
||||||
parse_header(unsigned char *head, unsigned char *item, unsigned char **ptr)
|
parse_header(unsigned char *head, const unsigned char *item, unsigned char **ptr)
|
||||||
{
|
{
|
||||||
unsigned char *pos = head;
|
unsigned char *pos = head;
|
||||||
|
|
||||||
if (!pos) return NULL;
|
if (!pos) return NULL;
|
||||||
|
|
||||||
while (*pos) {
|
while (*pos) {
|
||||||
unsigned char *end, *itempos, *value;
|
unsigned char *end, *value;
|
||||||
|
const unsigned char *itempos;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* Go for a newline. */
|
/* Go for a newline. */
|
||||||
|
@ -9,7 +9,7 @@ enum parse_header_param {
|
|||||||
* Unknown values should be treated as errors. */
|
* Unknown values should be treated as errors. */
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned char *parse_header(unsigned char *, unsigned char *, unsigned char **);
|
unsigned char *parse_header(unsigned char *, const unsigned char *, unsigned char **);
|
||||||
enum parse_header_param parse_header_param(unsigned char *, unsigned char *, unsigned char **);
|
enum parse_header_param parse_header_param(unsigned char *, unsigned char *, unsigned char **);
|
||||||
unsigned char *get_header_param(unsigned char *, unsigned char *);
|
unsigned char *get_header_param(unsigned char *, unsigned char *);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user