1
0
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:
Kalle Olavi Niemitalo 2012-11-18 16:39:04 +02:00 committed by Kalle Olavi Niemitalo
parent f72cedf92d
commit 0386a3e14b
2 changed files with 4 additions and 3 deletions

View File

@ -116,14 +116,15 @@
#define LWS(c) ((c) == ' ' || (c) == ASCII_TAB)
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;
if (!pos) return NULL;
while (*pos) {
unsigned char *end, *itempos, *value;
unsigned char *end, *value;
const unsigned char *itempos;
int len;
/* Go for a newline. */

View File

@ -9,7 +9,7 @@ enum parse_header_param {
* 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 **);
unsigned char *get_header_param(unsigned char *, unsigned char *);