Add const qualifier to some symbol/keyword functions

This commit is contained in:
Lassi Kortela 2019-08-10 00:30:20 +03:00
parent 3751d83390
commit be6a18175f
2 changed files with 6 additions and 6 deletions

View File

@ -261,12 +261,12 @@ SAFECAST_OP(string, char *, cvalue_data)
struct symbol *symtab = NULL; struct symbol *symtab = NULL;
int fl_is_keyword_name(char *str, size_t len) int fl_is_keyword_name(const char *str, size_t len)
{ {
return ((str[0] == ':' || str[len - 1] == ':') && str[1] != '\0'); return ((str[0] == ':' || str[len - 1] == ':') && str[1] != '\0');
} }
static struct symbol *mk_symbol(char *str) static struct symbol *mk_symbol(const char *str)
{ {
struct symbol *sym; struct symbol *sym;
size_t len = strlen(str); size_t len = strlen(str);
@ -289,7 +289,7 @@ static struct symbol *mk_symbol(char *str)
return sym; return sym;
} }
static struct symbol **symtab_lookup(struct symbol **ptree, char *str) static struct symbol **symtab_lookup(struct symbol **ptree, const char *str)
{ {
int x; int x;
@ -305,7 +305,7 @@ static struct symbol **symtab_lookup(struct symbol **ptree, char *str)
return ptree; return ptree;
} }
value_t symbol(char *str) value_t symbol(const char *str)
{ {
struct symbol **pnode; struct symbol **pnode;

View File

@ -141,9 +141,9 @@ extern value_t printprettysym, printreadablysym, printwidthsym;
value_t fl_cons(value_t a, value_t b); value_t fl_cons(value_t a, value_t b);
value_t fl_list2(value_t a, value_t b); value_t fl_list2(value_t a, value_t b);
value_t fl_listn(size_t n, ...); value_t fl_listn(size_t n, ...);
value_t symbol(char *str); value_t symbol(const char *str);
char *symbol_name(value_t v); char *symbol_name(value_t v);
int fl_is_keyword_name(char *str, size_t len); int fl_is_keyword_name(const char *str, size_t len);
value_t alloc_vector(size_t n, int init); value_t alloc_vector(size_t n, int init);
size_t llength(value_t v); size_t llength(value_t v);
value_t fl_compare(value_t a, value_t b); // -1, 0, or 1 value_t fl_compare(value_t a, value_t b); // -1, 0, or 1