add MB_DISABLE_LOAD_FILE to disable _load_file

This will disable loading any script without going through either
the import_handler or by loading a module.
This commit is contained in:
RushFan 2016-12-31 14:33:11 -08:00
parent 4bf8c7e83f
commit 9090b6c609

View File

@ -32,6 +32,7 @@
#include "my_basic.h" #include "my_basic.h"
#if defined ARDUINO && !defined MB_CP_ARDUINO #if defined ARDUINO && !defined MB_CP_ARDUINO
# define MB_CP_ARDUINO # define MB_CP_ARDUINO
# define MB_DISABLE_LOAD_FILE
#endif /* ARDUINO && !MB_CP_ARDUINO */ #endif /* ARDUINO && !MB_CP_ARDUINO */
#ifdef MB_CP_VC #ifdef MB_CP_VC
# include <conio.h> # include <conio.h>
@ -4606,7 +4607,7 @@ static void _print_string(mb_interpreter_t* s, _object_t* obj) {
/* Read all content of a file into a buffer */ /* Read all content of a file into a buffer */
static char* _load_file(mb_interpreter_t* s, const char* f, const char* prefix) { static char* _load_file(mb_interpreter_t* s, const char* f, const char* prefix) {
#ifndef MB_CP_ARDUINO #ifndef MB_DISABLE_LOAD_FILE
FILE* fp = 0; FILE* fp = 0;
char* buf = 0; char* buf = 0;
long curpos = 0; long curpos = 0;