🚀 optimize code
This commit is contained in:
parent
7ddb8593ad
commit
0493e18d0e
2
main.cpp
2
main.cpp
|
@ -53,7 +53,7 @@ void logo()
|
|||
<<" / \\/ / _` / __|/ _` | |\n"
|
||||
<<" / /\\ / (_| \\__ \\ (_| | |\n"
|
||||
<<" \\_\\ \\/ \\__,_|___/\\__,_|_|\n"
|
||||
<<"nasal ver : "<<__nasver<<"\n"
|
||||
<<"nasal ver : "<<__nasver<<" ("<<__DATE__<<")\n"
|
||||
<<"c++ std : "<<__cplusplus<<"\n"
|
||||
<<"thanks to : https://github.com/andyross/nasal\n"
|
||||
<<"code repo : https://github.com/ValKmjolnir/Nasal-Interpreter\n"
|
||||
|
|
|
@ -133,8 +133,7 @@ nas_ref builtin_split(nas_ref* local,nasal_gc& gc)
|
|||
gc.temp=nil;
|
||||
return res;
|
||||
}
|
||||
usize last=0;
|
||||
usize pos=s.find(deli,last);
|
||||
usize last=0,pos=s.find(deli,0);
|
||||
while(pos!=string::npos)
|
||||
{
|
||||
if(pos>last)
|
||||
|
|
|
@ -34,8 +34,7 @@ nasal_import::nasal_import(nasal_err& e):lib_loaded(false),nerr(e){
|
|||
char sep=':';
|
||||
#endif
|
||||
string PATH=getenv("PATH");
|
||||
usize last=0;
|
||||
usize pos=PATH.find(sep,last);
|
||||
usize last=0,pos=PATH.find(sep,0);
|
||||
while(pos!=string::npos)
|
||||
{
|
||||
string dirpath=PATH.substr(last,pos-last);
|
||||
|
|
|
@ -5,6 +5,8 @@ var file={
|
|||
SEEK_CUR:io.SEEK_CUR,
|
||||
SEEK_END:io.SEEK_END,
|
||||
new: func(filename,mode="r"){
|
||||
if(!io.exists(filename))
|
||||
return nil;
|
||||
var fd=io.open(filename,mode);
|
||||
return {
|
||||
close: func(){io.close(fd);},
|
||||
|
@ -24,6 +26,8 @@ var file={
|
|||
};
|
||||
|
||||
var find_all_files=func(path){
|
||||
if(!io.exists(path))
|
||||
return [];
|
||||
var dd=unix.opendir(path);
|
||||
var res=[];
|
||||
while(var n=unix.readdir(dd))
|
||||
|
|
Loading…
Reference in New Issue