Make improvements

- Expand redbean UNIX module
- Expand redbean documentation
- Ensure Lua copyright is embedded in binary
- Increase the PATH_MAX limit especially on NT
- Use column major sorting for linenoise completions
- Fix some suboptimalities in redbean's new UNIX API
- Figured out right flags for Multics newline in raw mode
This commit is contained in:
Justine Tunney 2022-04-24 09:59:22 -07:00
parent cf3174dc74
commit 2046c0d2ae
305 changed files with 6602 additions and 4221 deletions

View file

@ -39,7 +39,7 @@ char *DecodeLatin1(const char *p, size_t n, size_t *z) {
if (n == -1) n = p ? strlen(p) : 0;
if ((q = r = malloc(n * 2 + 1))) {
for (i = 0; i < n;) {
memset(vz, 0, 16); /* 3x speedup for ASCII */
bzero(vz, 16); /* 3x speedup for ASCII */
while (i + 16 < n) {
memcpy(v1, p + i, 16);
pcmpgtb(v2, v1, vz);

View file

@ -40,7 +40,7 @@ char *EncodeLatin1(const char *p, size_t n, size_t *z, int f) {
size_t i;
char t[256];
char *r, *q;
memset(t, 0, sizeof(t));
bzero(t, sizeof(t));
if (f & kControlC0) memset(t + 0x00, 1, 0x20 - 0x00), t[0x7F] = 1;
if (f & kControlC1) memset(t + 0x80, 1, 0xA0 - 0x80);
t['\t'] = t['\r'] = t['\n'] = t['\v'] = !!(f & kControlWs);

View file

@ -21,6 +21,9 @@
#include "libc/str/str.h"
#include "net/http/http.h"
/**
* Collapses repeating headers onto a single line.
*/
char *FoldHeader(struct HttpMessage *msg, char *b, int h, size_t *z) {
char *p;
size_t i, n, m;

View file

@ -34,7 +34,7 @@ ssize_t HasControlCodes(const char *p, size_t n, int f) {
char t[256];
wint_t x, a, b;
size_t i, j, m, g;
memset(t, 0, sizeof(t));
bzero(t, sizeof(t));
if (f & kControlC0) memset(t + 0x00, 1, 0x20 - 0x00), t[0x7F] = 1;
if (f & kControlC1) memset(t + 0x80, 1, 0xA0 - 0x80);
t['\t'] = t['\r'] = t['\n'] = t['\v'] = !!(f & kControlWs);

View file

@ -36,7 +36,7 @@
*/
void InitHttpMessage(struct HttpMessage *r, int type) {
assert(type == kHttpRequest || type == kHttpResponse);
memset(r, 0, sizeof(*r));
bzero(r, sizeof(*r));
r->type = type;
}

View file

@ -257,7 +257,7 @@ static char *ParseUrlImpl(const char *s, size_t n, struct Url *h, bool latin1) {
u.isform = false;
u.isopaque = false;
u.islatin1 = latin1;
memset(h, 0, sizeof(*h));
bzero(h, sizeof(*h));
if ((m = malloc(latin1 ? u.n * 2 : u.n))) {
u.q = u.p = m;
if (ParseScheme(&u, h)) ParseAuthority(&u, h);

View file

@ -46,7 +46,7 @@ char *Underlong(const char *p, size_t n, size_t *z) {
if (n == -1) n = p ? strlen(p) : 0;
if ((q = r = malloc(n + 1))) {
for (i = 0; i < n;) {
memset(vz, 0, 16); /* 50x speedup for ASCII */
bzero(vz, 16); /* 50x speedup for ASCII */
while (i + 16 < n) {
memcpy(v1, p + i, 16);
pcmpgtb(v2, v1, vz);