diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-01-27 16:09:55 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-01-27 16:09:55 -0300 |
| commit | c4e7cdb541d89142056927ebdfd8f97017d38f45 (patch) | |
| tree | 1e356b5b4eed75d86050bab3f12026d5a70697b6 | |
| parent | 7d7ae8781e64e2b3b212d5c7b7c1b98b694df5ef (diff) | |
| download | lua-c4e7cdb541d89142056927ebdfd8f97017d38f45.tar.gz lua-c4e7cdb541d89142056927ebdfd8f97017d38f45.tar.bz2 lua-c4e7cdb541d89142056927ebdfd8f97017d38f45.zip | |
Renaming two new functions
'lua_numbertostrbuff' -> 'lua_numbertocstring'
'lua_pushextlstring' -> 'lua_pushexternalstring'
| -rw-r--r-- | lapi.c | 4 | ||||
| -rw-r--r-- | lauxlib.c | 6 | ||||
| -rw-r--r-- | liolib.c | 2 | ||||
| -rw-r--r-- | loadlib.c | 2 | ||||
| -rw-r--r-- | ltests.c | 4 | ||||
| -rw-r--r-- | lua.h | 4 | ||||
| -rw-r--r-- | manual/manual.of | 4 |
7 files changed, 13 insertions, 13 deletions
| @@ -366,7 +366,7 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { | |||
| 366 | } | 366 | } |
| 367 | 367 | ||
| 368 | 368 | ||
| 369 | LUA_API unsigned (lua_numbertostrbuff) (lua_State *L, int idx, char *buff) { | 369 | LUA_API unsigned (lua_numbertocstring) (lua_State *L, int idx, char *buff) { |
| 370 | const TValue *o = index2value(L, idx); | 370 | const TValue *o = index2value(L, idx); |
| 371 | if (ttisnumber(o)) { | 371 | if (ttisnumber(o)) { |
| 372 | unsigned len = luaO_tostringbuff(o, buff); | 372 | unsigned len = luaO_tostringbuff(o, buff); |
| @@ -546,7 +546,7 @@ LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { | |||
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | 548 | ||
| 549 | LUA_API const char *lua_pushextlstring (lua_State *L, | 549 | LUA_API const char *lua_pushexternalstring (lua_State *L, |
| 550 | const char *s, size_t len, lua_Alloc falloc, void *ud) { | 550 | const char *s, size_t len, lua_Alloc falloc, void *ud) { |
| 551 | TString *ts; | 551 | TString *ts; |
| 552 | lua_lock(L); | 552 | lua_lock(L); |
| @@ -622,9 +622,9 @@ LUALIB_API void luaL_pushresult (luaL_Buffer *B) { | |||
| 622 | resizebox(L, -1, len + 1); /* adjust box size to content size */ | 622 | resizebox(L, -1, len + 1); /* adjust box size to content size */ |
| 623 | s = (char*)box->box; /* final buffer address */ | 623 | s = (char*)box->box; /* final buffer address */ |
| 624 | s[len] = '\0'; /* add ending zero */ | 624 | s[len] = '\0'; /* add ending zero */ |
| 625 | /* clear box, as 'lua_pushextlstring' will take control over buffer */ | 625 | /* clear box, as Lua will take control of the buffer */ |
| 626 | box->bsize = 0; box->box = NULL; | 626 | box->bsize = 0; box->box = NULL; |
| 627 | lua_pushextlstring(L, s, len, allocf, ud); | 627 | lua_pushexternalstring(L, s, len, allocf, ud); |
| 628 | lua_closeslot(L, -2); /* close the box */ | 628 | lua_closeslot(L, -2); /* close the box */ |
| 629 | lua_gc(L, LUA_GCSTEP, len); | 629 | lua_gc(L, LUA_GCSTEP, len); |
| 630 | } | 630 | } |
| @@ -929,7 +929,7 @@ LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { | |||
| 929 | switch (lua_type(L, idx)) { | 929 | switch (lua_type(L, idx)) { |
| 930 | case LUA_TNUMBER: { | 930 | case LUA_TNUMBER: { |
| 931 | char buff[LUA_N2SBUFFSZ]; | 931 | char buff[LUA_N2SBUFFSZ]; |
| 932 | lua_numbertostrbuff(L, idx, buff); | 932 | lua_numbertocstring(L, idx, buff); |
| 933 | lua_pushstring(L, buff); | 933 | lua_pushstring(L, buff); |
| 934 | break; | 934 | break; |
| 935 | } | 935 | } |
| @@ -667,7 +667,7 @@ static int g_write (lua_State *L, FILE *f, int arg) { | |||
| 667 | for (; nargs--; arg++) { | 667 | for (; nargs--; arg++) { |
| 668 | char buff[LUA_N2SBUFFSZ]; | 668 | char buff[LUA_N2SBUFFSZ]; |
| 669 | const char *s; | 669 | const char *s; |
| 670 | size_t len = lua_numbertostrbuff(L, arg, buff); /* try as a number */ | 670 | size_t len = lua_numbertocstring(L, arg, buff); /* try as a number */ |
| 671 | if (len > 0) { /* did conversion work (value was a number)? */ | 671 | if (len > 0) { /* did conversion work (value was a number)? */ |
| 672 | s = buff; | 672 | s = buff; |
| 673 | len--; | 673 | len--; |
| @@ -280,7 +280,7 @@ static void setpath (lua_State *L, const char *fieldname, | |||
| 280 | if (path == NULL) /* no versioned environment variable? */ | 280 | if (path == NULL) /* no versioned environment variable? */ |
| 281 | path = getenv(envname); /* try unversioned name */ | 281 | path = getenv(envname); /* try unversioned name */ |
| 282 | if (path == NULL || noenv(L)) /* no environment variable? */ | 282 | if (path == NULL || noenv(L)) /* no environment variable? */ |
| 283 | lua_pushextlstring(L, dft, strlen(dft), NULL, NULL); /* use default */ | 283 | lua_pushexternalstring(L, dft, strlen(dft), NULL, NULL); /* use default */ |
| 284 | else if ((dftmark = strstr(path, LUA_PATH_SEP LUA_PATH_SEP)) == NULL) | 284 | else if ((dftmark = strstr(path, LUA_PATH_SEP LUA_PATH_SEP)) == NULL) |
| 285 | lua_pushstring(L, path); /* nothing to change */ | 285 | lua_pushstring(L, path); /* nothing to change */ |
| 286 | else { /* path contains a ";;": insert default path in its place */ | 286 | else { /* path contains a ";;": insert default path in its place */ |
| @@ -1389,7 +1389,7 @@ static int checkpanic (lua_State *L) { | |||
| 1389 | static int externKstr (lua_State *L) { | 1389 | static int externKstr (lua_State *L) { |
| 1390 | size_t len; | 1390 | size_t len; |
| 1391 | const char *s = luaL_checklstring(L, 1, &len); | 1391 | const char *s = luaL_checklstring(L, 1, &len); |
| 1392 | lua_pushextlstring(L, s, len, NULL, NULL); | 1392 | lua_pushexternalstring(L, s, len, NULL, NULL); |
| 1393 | return 1; | 1393 | return 1; |
| 1394 | } | 1394 | } |
| 1395 | 1395 | ||
| @@ -1413,7 +1413,7 @@ static int externstr (lua_State *L) { | |||
| 1413 | /* copy string content to buffer, including ending 0 */ | 1413 | /* copy string content to buffer, including ending 0 */ |
| 1414 | memcpy(buff, s, (len + 1) * sizeof(char)); | 1414 | memcpy(buff, s, (len + 1) * sizeof(char)); |
| 1415 | /* create external string */ | 1415 | /* create external string */ |
| 1416 | lua_pushextlstring(L, buff, len, allocf, ud); | 1416 | lua_pushexternalstring(L, buff, len, allocf, ud); |
| 1417 | return 1; | 1417 | return 1; |
| 1418 | } | 1418 | } |
| 1419 | 1419 | ||
| @@ -244,7 +244,7 @@ LUA_API void (lua_pushnil) (lua_State *L); | |||
| 244 | LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); | 244 | LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); |
| 245 | LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); | 245 | LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); |
| 246 | LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len); | 246 | LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len); |
| 247 | LUA_API const char *(lua_pushextlstring) (lua_State *L, | 247 | LUA_API const char *(lua_pushexternalstring) (lua_State *L, |
| 248 | const char *s, size_t len, lua_Alloc falloc, void *ud); | 248 | const char *s, size_t len, lua_Alloc falloc, void *ud); |
| 249 | LUA_API const char *(lua_pushstring) (lua_State *L, const char *s); | 249 | LUA_API const char *(lua_pushstring) (lua_State *L, const char *s); |
| 250 | LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, | 250 | LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, |
| @@ -372,7 +372,7 @@ LUA_API void (lua_concat) (lua_State *L, int n); | |||
| 372 | LUA_API void (lua_len) (lua_State *L, int idx); | 372 | LUA_API void (lua_len) (lua_State *L, int idx); |
| 373 | 373 | ||
| 374 | #define LUA_N2SBUFFSZ 64 | 374 | #define LUA_N2SBUFFSZ 64 |
| 375 | LUA_API unsigned (lua_numbertostrbuff) (lua_State *L, int idx, char *buff); | 375 | LUA_API unsigned (lua_numbertocstring) (lua_State *L, int idx, char *buff); |
| 376 | LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s); | 376 | LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s); |
| 377 | 377 | ||
| 378 | LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); | 378 | LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); |
diff --git a/manual/manual.of b/manual/manual.of index 150315d4..274799e3 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
| @@ -3829,7 +3829,7 @@ This macro may evaluate its arguments more than once. | |||
| 3829 | 3829 | ||
| 3830 | } | 3830 | } |
| 3831 | 3831 | ||
| 3832 | @APIEntry{unsigned (lua_numbertostrbuff) (lua_State *L, int idx, | 3832 | @APIEntry{unsigned (lua_numbertocstring) (lua_State *L, int idx, |
| 3833 | char *buff);| | 3833 | char *buff);| |
| 3834 | @apii{0,0,-} | 3834 | @apii{0,0,-} |
| 3835 | 3835 | ||
| @@ -3955,7 +3955,7 @@ This function is equivalent to @Lid{lua_pushcclosure} with no upvalues. | |||
| 3955 | 3955 | ||
| 3956 | } | 3956 | } |
| 3957 | 3957 | ||
| 3958 | @APIEntry{const char *(lua_pushextlstring) (lua_State *L, | 3958 | @APIEntry{const char *(lua_pushexternalstring) (lua_State *L, |
| 3959 | const char *s, size_t len, lua_Alloc falloc, void *ud);| | 3959 | const char *s, size_t len, lua_Alloc falloc, void *ud);| |
| 3960 | @apii{0,1,m} | 3960 | @apii{0,1,m} |
| 3961 | 3961 | ||
