*it's better to use const char* for some callbacks.

This commit is contained in:
Wang Renxin 2017-11-22 15:48:16 +08:00
parent 246348777d
commit 7ee57db895
3 changed files with 4 additions and 4 deletions

Binary file not shown.

View File

@ -556,8 +556,8 @@ typedef int (* mb_func_t)(struct mb_interpreter_t*, void**);
typedef int (* mb_has_routine_arg_func_t)(struct mb_interpreter_t*, void**, mb_value_t*, unsigned, unsigned*, void*);
typedef int (* mb_pop_routine_arg_func_t)(struct mb_interpreter_t*, void**, mb_value_t*, unsigned, unsigned*, void*, mb_value_t*);
typedef int (* mb_routine_func_t)(struct mb_interpreter_t*, void**, mb_value_t*, unsigned, void*, mb_has_routine_arg_func_t, mb_pop_routine_arg_func_t);
typedef int (* mb_debug_stepped_handler_t)(struct mb_interpreter_t*, void**, char*, int, unsigned short, unsigned short);
typedef void (* mb_error_handler_t)(struct mb_interpreter_t*, mb_error_e, char*, char*, int, unsigned short, unsigned short, int);
typedef int (* mb_debug_stepped_handler_t)(struct mb_interpreter_t*, void**, const char*, int, unsigned short, unsigned short);
typedef void (* mb_error_handler_t)(struct mb_interpreter_t*, mb_error_e, const char*, const char*, int, unsigned short, unsigned short, int);
typedef int (* mb_print_func_t)(const char*, ...);
typedef int (* mb_input_func_t)(const char*, char*, int);
typedef int (* mb_import_handler_t)(struct mb_interpreter_t*, const char*);

View File

@ -1439,7 +1439,7 @@ static int beep(struct mb_interpreter_t* s, void** l) {
** Callbacks and handlers
*/
static int _on_stepped(struct mb_interpreter_t* s, void** l, char* f, int p, unsigned short row, unsigned short col) {
static int _on_stepped(struct mb_interpreter_t* s, void** l, const char* f, int p, unsigned short row, unsigned short col) {
mb_unrefvar(s);
mb_unrefvar(l);
mb_unrefvar(f);
@ -1450,7 +1450,7 @@ static int _on_stepped(struct mb_interpreter_t* s, void** l, char* f, int p, uns
return MB_FUNC_OK;
}
static void _on_error(struct mb_interpreter_t* s, mb_error_e e, char* m, char* f, int p, unsigned short row, unsigned short col, int abort_code) {
static void _on_error(struct mb_interpreter_t* s, mb_error_e e, const char* m, const char* f, int p, unsigned short row, unsigned short col, int abort_code) {
mb_unrefvar(s);
mb_unrefvar(p);