mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 14:22:28 +00:00
Reduce header complexity
- Remove most __ASSEMBLER__ __LINKER__ ifdefs - Rename libc/intrin/bits.h to libc/serialize.h - Block pthread cancelation in fchmodat() polyfill - Remove `clang-format off` statements in third_party
This commit is contained in:
parent
96f979dfc5
commit
fa20edc44d
3057 changed files with 410 additions and 4398 deletions
|
@ -26,7 +26,7 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/fmt/leb128.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/intrin/bsf.h"
|
||||
#include "libc/intrin/bsr.h"
|
||||
#include "libc/intrin/popcnt.h"
|
||||
|
@ -606,16 +606,16 @@ int LuaEncodeLatin1(lua_State *L) {
|
|||
}
|
||||
|
||||
dontinline int LuaBase32Impl(lua_State *L,
|
||||
char *B32(const char *, size_t, const char *, size_t, size_t *)) {
|
||||
char *B32(const char *, size_t, const char *,
|
||||
size_t, size_t *)) {
|
||||
char *p;
|
||||
size_t sl, al; // source/output and alphabet lengths
|
||||
size_t sl, al; // source/output and alphabet lengths
|
||||
const char *s = luaL_checklstring(L, 1, &sl);
|
||||
// use an empty string, as EncodeBase32 provides a default value
|
||||
const char *a = luaL_optlstring(L, 2, "", &al);
|
||||
if (!IS2POW(al) || al > 128 || al == 1)
|
||||
return luaL_error(L, "alphabet length is not a power of 2 in range 2..128");
|
||||
if (!(p = B32(s, sl, a, al, &sl)))
|
||||
return luaL_error(L, "out of memory");
|
||||
if (!(p = B32(s, sl, a, al, &sl))) return luaL_error(L, "out of memory");
|
||||
lua_pushlstring(L, p, sl);
|
||||
free(p);
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue