Skip to content

Commit 1a4d40c

Browse files
committed
chore: rename some functions name
Signed-off-by: Jianhui Zhao <[email protected]>
1 parent 13559c6 commit 1a4d40c

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

file.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static int lua_file_close(lua_State *L)
5151
return 1;
5252
}
5353

54-
static int lua_file_read(lua_State *L)
54+
static int lua_read(lua_State *L)
5555
{
5656
int fd = luaL_checkinteger(L, 1);
5757
size_t n = luaL_checkinteger(L, 2);
@@ -85,7 +85,7 @@ static int lua_file_read(lua_State *L)
8585
return 1;
8686
}
8787

88-
static int lua_file_write(lua_State *L)
88+
static int lua_write(lua_State *L)
8989
{
9090
int fd = luaL_checkinteger(L, 1);
9191
size_t len;
@@ -109,7 +109,7 @@ static int lua_file_write(lua_State *L)
109109
return 1;
110110
}
111111

112-
static int lua_file_lseek(lua_State *L)
112+
static int lua_lseek(lua_State *L)
113113
{
114114
int fd = luaL_checkinteger(L, 1);
115115
off_t offset = luaL_checkinteger(L, 2);
@@ -126,7 +126,7 @@ static int lua_file_lseek(lua_State *L)
126126
return 1;
127127
}
128128

129-
static int lua_file_access(lua_State *L)
129+
static int lua_access(lua_State *L)
130130
{
131131
const char *file = luaL_checkstring(L, 1);
132132
const char *mode = lua_tostring(L, 2);
@@ -210,7 +210,7 @@ static int __lua_file_stat(lua_State *L, struct stat *st)
210210
return 1;
211211
}
212212

213-
static int lua_file_stat(lua_State *L)
213+
static int lua_stat(lua_State *L)
214214
{
215215
const char *path = luaL_checkstring(L, 1);
216216
struct stat st;
@@ -224,7 +224,7 @@ static int lua_file_stat(lua_State *L)
224224
return __lua_file_stat(L, &st);
225225
}
226226

227-
static int lua_file_fstat(lua_State *L)
227+
static int lua_fstat(lua_State *L)
228228
{
229229
int fd = luaL_checkinteger(L, 1);
230230
struct stat st;
@@ -239,7 +239,7 @@ static int lua_file_fstat(lua_State *L)
239239
}
240240

241241
/* get filesystem statistics in kibibytes */
242-
static int lua_file_statvfs(lua_State *L)
242+
static int lua_statvfs(lua_State *L)
243243
{
244244
const char *path = luaL_checkstring(L, 1);
245245
struct statvfs s;
@@ -325,7 +325,7 @@ static const struct luaL_Reg dir_methods[] = {
325325
{NULL, NULL}
326326
};
327327

328-
static int lua_file_chown(lua_State *L)
328+
static int lua_chown(lua_State *L)
329329
{
330330
const char *pathname = luaL_checkstring(L, 1);
331331
uid_t uid = -1;
@@ -348,7 +348,7 @@ static int lua_file_chown(lua_State *L)
348348
return 1;
349349
}
350350

351-
static int lua_file_dirname(lua_State *L)
351+
static int lua_dirname(lua_State *L)
352352
{
353353
const char *path = luaL_checkstring(L, 1);
354354
char *buf = strdup(path);
@@ -359,7 +359,7 @@ static int lua_file_dirname(lua_State *L)
359359
return 1;
360360
}
361361

362-
static int lua_file_basename(lua_State *L)
362+
static int lua_basename(lua_State *L)
363363
{
364364
const char *path = luaL_checkstring(L, 1);
365365
char *buf = strdup(path);
@@ -370,7 +370,7 @@ static int lua_file_basename(lua_State *L)
370370
return 1;
371371
}
372372

373-
static int lua_file_flock(lua_State *L)
373+
static int lua_flock(lua_State *L)
374374
{
375375
int fd = luaL_checkinteger(L, 1);
376376
int operation = luaL_checkinteger(L, 2);
@@ -389,18 +389,18 @@ static int lua_file_flock(lua_State *L)
389389
static const luaL_Reg funcs[] = {
390390
{"open", lua_file_open},
391391
{"close", lua_file_close},
392-
{"read", lua_file_read},
393-
{"write", lua_file_write},
394-
{"lseek", lua_file_lseek},
395-
{"access", lua_file_access},
392+
{"read", lua_read},
393+
{"write", lua_write},
394+
{"lseek", lua_lseek},
395+
{"access", lua_access},
396396
{"readlink", lua_readlink},
397-
{"stat", lua_file_stat},
398-
{"fstat", lua_file_fstat},
399-
{"statvfs", lua_file_statvfs},
400-
{"chown", lua_file_chown},
401-
{"dirname", lua_file_dirname},
402-
{"basename", lua_file_basename},
403-
{"flock", lua_file_flock},
397+
{"stat", lua_stat},
398+
{"fstat", lua_fstat},
399+
{"statvfs", lua_statvfs},
400+
{"chown", lua_chown},
401+
{"dirname", lua_dirname},
402+
{"basename", lua_basename},
403+
{"flock", lua_flock},
404404
{NULL, NULL}
405405
};
406406

0 commit comments

Comments
 (0)