mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Use a more appropriate type for the reader_test function
This commit is contained in:
parent
3722f91e38
commit
0748a4d8b6
2 changed files with 8 additions and 7 deletions
10
reader.cpp
10
reader.cpp
|
@ -336,7 +336,7 @@ public:
|
|||
/**
|
||||
Function for testing if the string can be returned
|
||||
*/
|
||||
int (*test_func)(const wchar_t *);
|
||||
parser_test_error_bits_t (*test_func)(const wchar_t *);
|
||||
|
||||
/**
|
||||
When this is true, the reader will exit
|
||||
|
@ -2548,7 +2548,7 @@ void reader_run_command(parser_t &parser, const wcstring &cmd)
|
|||
}
|
||||
|
||||
|
||||
int reader_shell_test(const wchar_t *b)
|
||||
parser_test_error_bits_t reader_shell_test(const wchar_t *b)
|
||||
{
|
||||
assert(b != NULL);
|
||||
wcstring bstr = b;
|
||||
|
@ -2557,7 +2557,7 @@ int reader_shell_test(const wchar_t *b)
|
|||
bstr.push_back(L'\n');
|
||||
|
||||
parse_error_list_t errors;
|
||||
int res = parse_util_detect_errors(bstr, &errors, true /* do accept incomplete */);
|
||||
parser_test_error_bits_t res = parse_util_detect_errors(bstr, &errors, true /* do accept incomplete */);
|
||||
|
||||
if (res & PARSER_TEST_ERROR)
|
||||
{
|
||||
|
@ -2579,7 +2579,7 @@ int reader_shell_test(const wchar_t *b)
|
|||
detection for general purpose, there are no invalid strings, so
|
||||
this function always returns false.
|
||||
*/
|
||||
static int default_test(const wchar_t *b)
|
||||
static parser_test_error_bits_t default_test(const wchar_t *b)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -2665,7 +2665,7 @@ void reader_set_highlight_function(highlight_function_t func)
|
|||
data->highlight_function = func;
|
||||
}
|
||||
|
||||
void reader_set_test_function(int (*f)(const wchar_t *))
|
||||
void reader_set_test_function(parser_test_error_bits_t (*f)(const wchar_t *))
|
||||
{
|
||||
data->test_func = f;
|
||||
}
|
||||
|
|
5
reader.h
5
reader.h
|
@ -17,6 +17,7 @@
|
|||
#include "common.h"
|
||||
#include "complete.h"
|
||||
#include "highlight.h"
|
||||
#include "parse_constants.h"
|
||||
|
||||
class parser_t;
|
||||
class completion_t;
|
||||
|
@ -247,7 +248,7 @@ void reader_set_highlight_function(highlight_function_t);
|
|||
Specify function for testing if the command buffer contains syntax
|
||||
errors that must be corrected before returning.
|
||||
*/
|
||||
void reader_set_test_function(int (*f)(const wchar_t *));
|
||||
void reader_set_test_function(parser_test_error_bits_t (*f)(const wchar_t *));
|
||||
|
||||
/**
|
||||
Specify string of shell commands to be run in order to generate the
|
||||
|
@ -291,7 +292,7 @@ int reader_exit_forced();
|
|||
Test if the given shell command contains errors. Uses parser_test
|
||||
for testing. Suitable for reader_set_test_function().
|
||||
*/
|
||||
int reader_shell_test(const wchar_t *b);
|
||||
parser_test_error_bits_t reader_shell_test(const wchar_t *b);
|
||||
|
||||
/**
|
||||
Test whether the interactive reader is in search mode.
|
||||
|
|
Loading…
Reference in a new issue