Use const variables in eval as much as possible.
This commit is contained in:
10
src/eval.c
10
src/eval.c
@@ -14,7 +14,7 @@ static liblex_result foreach_errors[2] = {
|
||||
void eval_config_init(eval_config* config){
|
||||
ll_init(&config->states);
|
||||
}
|
||||
liblex_result eval_config_add(eval_config* config, char* ptrn, int pattern_id){
|
||||
liblex_result eval_config_add(eval_config* config, const char* ptrn, int pattern_id){
|
||||
liblex_result result;
|
||||
pattern* new_pattern = malloc(sizeof(*new_pattern));
|
||||
if(new_pattern){
|
||||
@@ -154,7 +154,7 @@ int _eval_foreach_find_match(void *data, va_list args){
|
||||
return 0;
|
||||
}
|
||||
|
||||
liblex_result eval_word(char* string, size_t index, eval_config* config, match* mtch){
|
||||
liblex_result eval_word(const char* string, size_t index, eval_config* config, match* mtch){
|
||||
liblex_result result = LIBLEX_SUCCESS;
|
||||
eval evl;
|
||||
evl.index = evl.begin = index;
|
||||
@@ -177,8 +177,8 @@ liblex_result eval_word(char* string, size_t index, eval_config* config, match*
|
||||
int largest_id = -1;
|
||||
ll_foreach(&evl.matches, NULL, compare_always, _eval_foreach_find_match, &largest_id, mtch);
|
||||
} else {
|
||||
mtch->from = -1;
|
||||
mtch->to = -1;
|
||||
mtch->from = 0;
|
||||
mtch->to = 0;
|
||||
mtch->pattern = -1;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ liblex_result eval_word(char* string, size_t index, eval_config* config, match*
|
||||
|
||||
return result;
|
||||
}
|
||||
liblex_result eval_all(char* string, size_t index, eval_config* config, ll* matches){
|
||||
liblex_result eval_all(const char* string, size_t index, eval_config* config, ll* matches){
|
||||
liblex_result result = LIBLEX_SUCCESS;
|
||||
match* new_match = NULL;
|
||||
int done = 0;
|
||||
|
||||
Reference in New Issue
Block a user