0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-06-30 22:19:29 -04:00

get_color_string: Return a pointer to const.

This commit is contained in:
Kalle Olavi Niemitalo 2007-01-28 00:52:21 +02:00 committed by Kalle Olavi Niemitalo
parent add2a5d1b5
commit 0484f68b69
4 changed files with 6 additions and 6 deletions

View File

@ -166,7 +166,7 @@ redir_add(struct option *opt, unsigned char *str)
/* Support functions for config file parsing. */ /* Support functions for config file parsing. */
static void static void
add_optstring_to_string(struct string *s, unsigned char *q, int qlen) add_optstring_to_string(struct string *s, const unsigned char *q, int qlen)
{ {
if (!commandline) add_char_to_string(s, '"'); if (!commandline) add_char_to_string(s, '"');
add_quoted_to_string(s, q, qlen); add_quoted_to_string(s, q, qlen);
@ -364,7 +364,7 @@ color_wr(struct option *opt, struct string *str)
{ {
color_T color = opt->value.color; color_T color = opt->value.color;
unsigned char hexcolor[8]; unsigned char hexcolor[8];
unsigned char *strcolor = get_color_string(color, hexcolor); const unsigned char *strcolor = get_color_string(color, hexcolor);
add_optstring_to_string(str, strcolor, strlen(strcolor)); add_optstring_to_string(str, strcolor, strlen(strcolor));
} }

View File

@ -599,7 +599,7 @@ l_get_option(LS)
{ {
color_T color; color_T color;
unsigned char hexcolor[8]; unsigned char hexcolor[8];
unsigned char *strcolor; const unsigned char *strcolor;
color = opt->value.color; color = opt->value.color;
strcolor = get_color_string(color, hexcolor); strcolor = get_color_string(color, hexcolor);

View File

@ -18,7 +18,7 @@
#include "util/string.h" #include "util/string.h"
struct color_spec { struct color_spec {
char *name; const char *name;
color_T rgb; color_T rgb;
}; };
@ -135,7 +135,7 @@ decode_hex_color:
return -1; /* Not found */ return -1; /* Not found */
} }
unsigned char * const unsigned char *
get_color_string(color_T color, unsigned char hexcolor[8]) get_color_string(color_T color, unsigned char hexcolor[8])
{ {
struct color_spec *cs; struct color_spec *cs;

View File

@ -17,7 +17,7 @@ int decode_color(unsigned char *str, int slen, color_T *color);
/* Returns a string containing the color info. If no ``English'' name can be /* Returns a string containing the color info. If no ``English'' name can be
* found the hex color (#rrggbb) is returned in the given buffer. */ * found the hex color (#rrggbb) is returned in the given buffer. */
unsigned char *get_color_string(color_T color, unsigned char hexcolor[8]); const unsigned char *get_color_string(color_T color, unsigned char hexcolor[8]);
/* Translate rgb color to string in #rrggbb format. str should be a pointer to /* Translate rgb color to string in #rrggbb format. str should be a pointer to
* a 8 bytes memory space. */ * a 8 bytes memory space. */