shithub: lu9-p9

Download patch

ref: 5ec928da062ba2fe97c3f7f0e9aed7473bbfa90e
parent: aaaf0950ed2342ba80faea7f5941061542070775
author: kvik <[email protected]>
date: Sun Apr 18 18:53:26 EDT 2021

fs: distinguish file method names from module funcs

--- a/fs.c
+++ b/fs.c
@@ -175,7 +175,7 @@
 }
 
 static int
-p9_close(lua_State *L)
+p9_file_close(lua_State *L)
 {
 	if(close(filefd(L, 1)) == -1)
 		return error(L, "close: %r");
@@ -195,7 +195,7 @@
 }
 
 static int
-p9_seek(lua_State *L)
+p9_file_seek(lua_State *L)
 {
 	int fd, type;
 	vlong n, off;
@@ -210,7 +210,7 @@
 }
 
 static int
-p9_read(lua_State *L)
+p9_file_read(lua_State *L)
 {
 	int fd;
 	long n, nbytes;
@@ -255,7 +255,7 @@
 }
 
 static int
-p9_slurp(lua_State *L)
+p9_file_slurp(lua_State *L)
 {
 	int fd;
 	long nbytes;
@@ -267,7 +267,7 @@
 }
 
 static int
-p9_write(lua_State *L)
+p9_file_write(lua_State *L)
 {
 	lua_Integer fd, offset;
 	size_t nbytes;
@@ -289,7 +289,7 @@
 }
 
 static int
-p9_path(lua_State *L)
+p9_file_path(lua_State *L)
 {
 	int fd;
 	char *buf;
@@ -303,7 +303,7 @@
 }
 
 static int
-p9_iounit(lua_State *L)
+p9_file_iounit(lua_State *L)
 {
 	int fd;
 	
@@ -313,7 +313,7 @@
 }
 
 static int
-p9_dup(lua_State *L)
+p9_file_dup(lua_State *L)
 {
 	int fd, new, na;
 	
--- a/p9.c
+++ b/p9.c
@@ -155,7 +155,6 @@
 	{"create", p9_create},
 	{"file", p9_file},
 	{"pipe", p9_pipe},
-	
 	{"remove", p9_remove},
 	
 	{"stat", p9_stat},
@@ -185,14 +184,14 @@
 	lua_setfield(L, LUA_REGISTRYINDEX, "p9-buffer");
 	
 	static luaL_Reg filemt[] = {
-		{"close", p9_close},
-		{"read", p9_read},
-		{"slurp", p9_slurp},
-		{"write", p9_write},
-		{"seek", p9_seek},
-		{"iounit", p9_iounit},
-		{"path", p9_path},
-		{"dup", p9_dup},
+		{"close", p9_file_close},
+		{"read", p9_file_read},
+		{"slurp", p9_file_slurp},
+		{"write", p9_file_write},
+		{"seek", p9_file_seek},
+		{"iounit", p9_file_iounit},
+		{"path", p9_file_path},
+		{"dup", p9_file_dup},
 		{nil, nil},
 	};
 	luaL_newmetatable(L, "p9-File");