Switch indices in strings to size_t.
This commit is contained in:
parent
8e29bdf52a
commit
1399934a24
|
@ -1,6 +1,7 @@
|
|||
#ifndef LIBLEX_EVAL_H
|
||||
#define LIBLEX_EVAL_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "pattern.h"
|
||||
#include "pairmap.h"
|
||||
#include "ll.h"
|
||||
|
@ -11,8 +12,8 @@
|
|||
* are used to represent "matched" hypohteses.
|
||||
*/
|
||||
struct match_s {
|
||||
int from;
|
||||
int to;
|
||||
size_t from;
|
||||
size_t to;
|
||||
int pattern;
|
||||
};
|
||||
|
||||
|
@ -28,11 +29,11 @@ struct eval_s {
|
|||
/**
|
||||
* The current index in the input.
|
||||
*/
|
||||
int index;
|
||||
size_t index;
|
||||
/**
|
||||
* The index where the valuation began.
|
||||
*/
|
||||
int begin;
|
||||
size_t begin;
|
||||
/**
|
||||
* The number of nodes / states matched in
|
||||
* the last iteration.
|
||||
|
@ -104,7 +105,7 @@ liblex_result eval_config_add(eval_config* config, char* pattern, int pattern_id
|
|||
* @param match pointer to where to store the newly created match.
|
||||
* @return LIBLEX_SUCCESS if all goes well, or LIBLEX_MALLOC if there was an allocation failure.
|
||||
*/
|
||||
liblex_result eval_word(char* string, int index, eval_config* config, match* match);
|
||||
liblex_result eval_word(char* string, size_t index, eval_config* config, match* match);
|
||||
/**
|
||||
* Evaluates input starting at the index until it reaches the null terminator,
|
||||
* adding the best matches to the linked list.
|
||||
|
@ -114,7 +115,7 @@ liblex_result eval_word(char* string, int index, eval_config* config, match* mat
|
|||
* @param matches the linked list to populate with matches
|
||||
* @return LIBLEX_SUCCESS if all goes well, or LIBLEX_MALLOC if there was an allocation failure.
|
||||
*/
|
||||
liblex_result eval_all(char* string, int index, eval_config* config, ll* matches);
|
||||
liblex_result eval_all(char* string, size_t index, eval_config* config, ll* matches);
|
||||
/**
|
||||
* Function intended to be passed to "foreach" calls in libds.
|
||||
* Since eval_all creates a lot of matches and puts them all in a linked list,
|
||||
|
|
|
@ -154,7 +154,7 @@ int _eval_foreach_find_match(void *data, va_list args){
|
|||
return 0;
|
||||
}
|
||||
|
||||
liblex_result eval_word(char* string, int index, eval_config* config, match* mtch){
|
||||
liblex_result eval_word(char* string, size_t index, eval_config* config, match* mtch){
|
||||
liblex_result result = LIBLEX_SUCCESS;
|
||||
eval evl;
|
||||
evl.index = evl.begin = index;
|
||||
|
@ -189,7 +189,7 @@ liblex_result eval_word(char* string, int index, eval_config* config, match* mtc
|
|||
|
||||
return result;
|
||||
}
|
||||
liblex_result eval_all(char* string, int index, eval_config* config, ll* matches){
|
||||
liblex_result eval_all(char* string, size_t index, eval_config* config, ll* matches){
|
||||
liblex_result result = LIBLEX_SUCCESS;
|
||||
match* new_match = NULL;
|
||||
int done = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user