lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 0897c0a4289ef3a8d45761266124613f364bef60
parent 5edacafcfa36a1fa86a7b5316bacf8c6a2c47227
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon,  8 Apr 2024 14:27:59 -0300

'getmode' renamed to 'getMode'

The name 'getmode' conficts with a function from BSD, defined
in <unistd.h>. Although 'lbaselib.c' cannot include that header,
'onelua.c' can.

Diffstat:
Mlbaselib.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lbaselib.c b/lbaselib.c @@ -336,7 +336,7 @@ static int load_aux (lua_State *L, int status, int envidx) { } -static const char *getmode (lua_State *L, int idx) { +static const char *getMode (lua_State *L, int idx) { const char *mode = luaL_optstring(L, idx, "bt"); if (strchr(mode, 'B') != NULL) /* Lua code cannot use fixed buffers */ luaL_argerror(L, idx, "invalid mode"); @@ -346,7 +346,7 @@ static const char *getmode (lua_State *L, int idx) { static int luaB_loadfile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); - const char *mode = getmode(L, 2); + const char *mode = getMode(L, 2); int env = (!lua_isnone(L, 3) ? 3 : 0); /* 'env' index or 0 if no 'env' */ int status = luaL_loadfilex(L, fname, mode); return load_aux(L, status, env); @@ -395,7 +395,7 @@ static int luaB_load (lua_State *L) { int status; size_t l; const char *s = lua_tolstring(L, 1, &l); - const char *mode = getmode(L, 3); + const char *mode = getMode(L, 3); int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */ if (s != NULL) { /* loading a string? */ const char *chunkname = luaL_optstring(L, 2, s);