Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
1798c6b7
Commit
1798c6b7
authored
Feb 14, 2015
by
funshine
Browse files
minor update
parent
2c5c00a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/lua/lauxlib.c
View file @
1798c6b7
...
...
@@ -652,8 +652,7 @@ LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {
typedef
struct
LoadFSF
{
int
extraline
;
int
f
;
char
*
buff
;
int
len
;
char
buff
[
LUAL_BUFFERSIZE
];
}
LoadFSF
;
...
...
@@ -666,7 +665,7 @@ static const char *getFSF (lua_State *L, void *ud, size_t *size) {
return
"
\n
"
;
}
if
(
fs_eof
(
lf
->
f
))
return
NULL
;
*
size
=
fs_read
(
lf
->
f
,
lf
->
buff
,
(
lf
->
len
));
*
size
=
fs_read
(
lf
->
f
,
lf
->
buff
,
sizeof
(
lf
->
buff
));
return
(
*
size
>
0
)
?
lf
->
buff
:
NULL
;
}
...
...
@@ -685,9 +684,6 @@ LUALIB_API int luaL_loadfsfile (lua_State *L, const char *filename) {
int
c
;
int
fnameindex
=
lua_gettop
(
L
)
+
1
;
/* index of filename on the stack */
lf
.
extraline
=
0
;
// lf.len = LUAL_BUFFERSIZE;
lf
.
len
=
0
;
lf
.
buff
=
NULL
;
if
(
filename
==
NULL
)
{
return
luaL_error
(
L
,
"filename is NULL"
);
}
...
...
@@ -696,10 +692,8 @@ LUALIB_API int luaL_loadfsfile (lua_State *L, const char *filename) {
lf
.
f
=
fs_open
(
filename
,
FS_RDONLY
);
if
(
lf
.
f
<
FS_OPEN_OK
)
return
errfsfile
(
L
,
"open"
,
fnameindex
);
}
lf
.
len
=
fs_size
(
lf
.
f
)
+
32
;
lf
.
buff
=
c_zalloc
(
lf
.
len
);
if
(
!
lf
.
buff
)
return
LUA_ERRMEM
;
// if(fs_size(lf.f)>LUAL_BUFFERSIZE)
// return luaL_error(L, "file is too big");
c
=
fs_getc
(
lf
.
f
);
if
(
c
==
'#'
)
{
/* Unix exec. file? */
lf
.
extraline
=
1
;
...
...
@@ -709,13 +703,7 @@ LUALIB_API int luaL_loadfsfile (lua_State *L, const char *filename) {
if
(
c
==
LUA_SIGNATURE
[
0
]
&&
filename
)
{
/* binary file? */
fs_close
(
lf
.
f
);
lf
.
f
=
fs_open
(
filename
,
FS_RDONLY
);
/* reopen in binary mode */
if
(
lf
.
f
<
FS_OPEN_OK
){
if
(
lf
.
buff
)
c_free
(
lf
.
buff
);
lf
.
buff
=
NULL
;
lf
.
len
=
0
;
return
errfsfile
(
L
,
"reopen"
,
fnameindex
);
}
if
(
lf
.
f
<
FS_OPEN_OK
)
return
errfsfile
(
L
,
"reopen"
,
fnameindex
);
/* skip eventual `#!...' */
while
((
c
=
fs_getc
(
lf
.
f
))
!=
EOF
&&
c
!=
LUA_SIGNATURE
[
0
])
;
lf
.
extraline
=
0
;
...
...
@@ -725,9 +713,6 @@ LUALIB_API int luaL_loadfsfile (lua_State *L, const char *filename) {
if
(
filename
)
fs_close
(
lf
.
f
);
/* close file (even in case of errors) */
lua_remove
(
L
,
fnameindex
);
if
(
lf
.
buff
)
c_free
(
lf
.
buff
);
lf
.
buff
=
NULL
;
return
status
;
}
...
...
app/lua/luaconf.h
View file @
1798c6b7
...
...
@@ -542,7 +542,7 @@ extern int readline4lua(const char *prompt, char *buffer, int length);
/*
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
*/
#define LUAL_BUFFERSIZE BUFSIZ
#define LUAL_BUFFERSIZE
((
BUFSIZ
)*4)
/* }================================================================== */
...
...
app/spiffs/spiffs.h
View file @
1798c6b7
...
...
@@ -466,5 +466,6 @@ int myspiffs_error( int fd );
void
myspiffs_clearerr
(
int
fd
);
int
myspiffs_check
(
void
);
int
myspiffs_rename
(
const
char
*
old
,
const
char
*
newname
);
size_t
myspiffs_size
(
int
fd
);
#endif
/* SPIFFS_H_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment