Switch indices in strings to size_t.

This commit is contained in:
2017-07-20 21:46:39 -07:00
parent 8e29bdf52a
commit 1399934a24
2 changed files with 9 additions and 8 deletions

View File

@@ -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,