mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Cleanup
This commit is contained in:
parent
96fafc5fb4
commit
0105346a11
1 changed files with 5 additions and 5 deletions
10
src/script.c
10
src/script.c
|
|
@ -215,8 +215,8 @@ static int send(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Function to add a character to the circular buffer
|
||||
void add_to_buffer(char c)
|
||||
// Function to add a character to the circular expect buffer
|
||||
static void expect_buffer_add(char c)
|
||||
{
|
||||
if (buffer_size < MAX_BUFFER_SIZE)
|
||||
{
|
||||
|
|
@ -230,8 +230,8 @@ void add_to_buffer(char c)
|
|||
}
|
||||
}
|
||||
|
||||
// Function to match against the circular buffer using regex
|
||||
bool match_regex(regex_t *regex)
|
||||
// Function to match against the circular expect buffer using regex
|
||||
static bool match_regex(regex_t *regex)
|
||||
{
|
||||
char buffer[MAX_BUFFER_SIZE + 1]; // Temporary buffer for regex matching
|
||||
const char *s = circular_buffer;
|
||||
|
|
@ -306,7 +306,7 @@ static int expect(lua_State *L)
|
|||
if (bytes_read > 0)
|
||||
{
|
||||
putchar(c);
|
||||
add_to_buffer(c);
|
||||
expect_buffer_add(c);
|
||||
// Match against the entire buffer
|
||||
if (match_regex(®ex))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue