1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Make http_code[] const; make http_code[].str point to const.

This commit is contained in:
Kalle Olavi Niemitalo 2007-02-04 15:18:45 +02:00 committed by Kalle Olavi Niemitalo
parent d7e4b57146
commit c8a57c562f

View File

@ -25,11 +25,11 @@
struct http_code {
int num;
unsigned char *str;
const unsigned char *str;
};
/* Source: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html */
static struct http_code http_code[] = {
static const struct http_code http_code[] = {
{ 100, "Continue" },
{ 101, "Switching Protocols" },
{ 200, "OK" },
@ -77,15 +77,16 @@ static int
compare_http_codes(const void *key, const void *element)
{
int first = (long) key;
int second = ((struct http_code *) element)->num;
int second = ((const struct http_code *) element)->num;
return first - second;
}
static unsigned char *
static const unsigned char *
http_code_to_string(int code)
{
struct http_code *element = bsearch((void *) (long) code, http_code,
const struct http_code *element
= bsearch((void *) (long) code, http_code,
sizeof_array(http_code),
sizeof(*element),
compare_http_codes);
@ -100,7 +101,7 @@ http_code_to_string(int code)
static unsigned char *
get_http_error_document(struct terminal *term, struct uri *uri, int code)
{
unsigned char *codestr = http_code_to_string(code);
const unsigned char *codestr = http_code_to_string(code);
unsigned char *title = asprintfa(_("HTTP error %03d", term), code);
struct string string;