mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-02 17:28:30 +00:00
Trim down redbean a little bit
This makes redbean.c a little less long. It also reduces the size of redbean-original.com from being 333K to 213K.
This commit is contained in:
parent
87029ac3f9
commit
5022f9e920
21 changed files with 999 additions and 669 deletions
14
third_party/quickjs/cutils.h
vendored
14
third_party/quickjs/cutils.h
vendored
|
@ -1,10 +1,9 @@
|
|||
#ifndef COSMOPOLITAN_THIRD_PARTY_QUICKJS_CUTILS_H_
|
||||
#define COSMOPOLITAN_THIRD_PARTY_QUICKJS_CUTILS_H_
|
||||
#include "libc/bits/bswap.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
/* clang-format off */
|
||||
#include "libc/bits/bswap.h"
|
||||
#include "libc/bits/bswap.h"
|
||||
|
||||
/* set if CPU is big endian */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
@ -16,9 +15,6 @@ COSMOPOLITAN_C_START_
|
|||
#define stringify(s) tostring(s)
|
||||
#define tostring(s) #s
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(type, field) ((size_t) &((type *)0)->field)
|
||||
#endif
|
||||
#ifndef countof
|
||||
#define countof(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
@ -32,10 +28,10 @@ enum {
|
|||
};
|
||||
#endif
|
||||
|
||||
void pstrcpy(char *buf, int buf_size, const char *str);
|
||||
char *pstrcat(char *buf, int buf_size, const char *s);
|
||||
int strstart(const char *str, const char *val, const char **ptr);
|
||||
int has_suffix(const char *str, const char *suffix);
|
||||
void pstrcpy(char *, int, const char *);
|
||||
char *pstrcat(char *, int, const char *);
|
||||
int strstart(const char *, const char *, const char **);
|
||||
int has_suffix(const char *, const char *);
|
||||
|
||||
static inline int max_int(int a, int b)
|
||||
{
|
||||
|
|
8
third_party/quickjs/quickjs.c
vendored
8
third_party/quickjs/quickjs.c
vendored
|
@ -12983,8 +12983,12 @@ static JSValue js_create_function(JSContext *ctx, JSFunctionDef *fd)
|
|||
}
|
||||
} else {
|
||||
b->vardefs = (void *)((uint8_t*)b + vardefs_offset);
|
||||
memcpy(b->vardefs, fd->args, fd->arg_count * sizeof(fd->args[0]));
|
||||
memcpy(b->vardefs + fd->arg_count, fd->vars, fd->var_count * sizeof(fd->vars[0]));
|
||||
if (fd->arg_count) {
|
||||
memcpy(b->vardefs, fd->args, fd->arg_count * sizeof(fd->args[0]));
|
||||
}
|
||||
if (fd->var_count) {
|
||||
memcpy(b->vardefs + fd->arg_count, fd->vars, fd->var_count * sizeof(fd->vars[0]));
|
||||
}
|
||||
}
|
||||
b->var_count = fd->var_count;
|
||||
b->arg_count = fd->arg_count;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue