Make numerous improvements

- Python static hello world now 1.8mb
- Python static fully loaded now 10mb
- Python HTTPS client now uses MbedTLS
- Python REPL now completes import stmts
- Increase stack size for Python for now
- Begin synthesizing posixpath and ntpath
- Restore Python \N{UNICODE NAME} support
- Restore Python NFKD symbol normalization
- Add optimized code path for Intel SHA-NI
- Get more Python unit tests passing faster
- Get Python help() pagination working on NT
- Python hashlib now supports MbedTLS PBKDF2
- Make memcpy/memmove/memcmp/bcmp/etc. faster
- Add Mersenne Twister and Vigna to LIBC_RAND
- Provide privileged __printf() for error code
- Fix zipos opendir() so that it reports ENOTDIR
- Add basic chmod() implementation for Windows NT
- Add Cosmo's best functions to Python cosmo module
- Pin function trace indent depth to that of caller
- Show memory diagram on invalid access in MODE=dbg
- Differentiate stack overflow on crash in MODE=dbg
- Add stb_truetype and tools for analyzing font files
- Upgrade to UNICODE 13 and reduce its binary footprint
- COMPILE.COM now logs resource usage of build commands
- Start implementing basic poll() support on bare metal
- Set getauxval(AT_EXECFN) to GetModuleFileName() on NT
- Add descriptions to strerror() in non-TINY build modes
- Add COUNTBRANCH() macro to help with micro-optimizations
- Make error / backtrace / asan / memory code more unbreakable
- Add fast perfect C implementation of μ-Law and a-Law audio codecs
- Make strtol() functions consistent with other libc implementations
- Improve Linenoise implementation (see also github.com/jart/bestline)
- COMPILE.COM now suppresses stdout/stderr of successful build commands
This commit is contained in:
Justine Tunney 2021-09-27 22:58:51 -07:00
parent fa7b4f5bd1
commit 39bf41f4eb
806 changed files with 77494 additions and 63859 deletions

View file

@ -245,7 +245,7 @@ typedef struct {
static void js_object_list_init(JSObjectList *s)
{
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
}
static uint32_t js_object_list_get_hash(JSObject *p, uint32_t hash_size)
@ -1134,7 +1134,7 @@ uint8_t *JS_WriteObject2(JSContext *ctx, size_t *psize, JSValueConst obj,
int flags, uint8_t ***psab_tab, size_t *psab_tab_len)
{
BCWriterState ss, *s = &ss;
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
s->ctx = ctx;
/* XXX: byte swapped output is untested */
s->byte_swap = ((flags & JS_WRITE_OBJ_BSWAP) != 0);
@ -1557,7 +1557,7 @@ static JSValue JS_ReadFunctionTag(BCReaderState *s)
int idx, i, local_count;
int function_size, cpool_offset, byte_code_offset;
int closure_var_offset, vardefs_offset;
memset(&bc, 0, sizeof(bc));
bzero(&bc, sizeof(bc));
bc.header.ref_count = 1;
//bc.gc_header.mark = 0;
if (bc_get_u16(s, &v16))
@ -2215,7 +2215,7 @@ JSValue JS_ReadObject(JSContext *ctx, const uint8_t *buf, size_t buf_len,
JSValue obj;
ctx->binary_object_count += 1;
ctx->binary_object_size += buf_len;
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
s->ctx = ctx;
s->buf_start = buf;
s->buf_end = buf + buf_len;

View file

@ -41,7 +41,7 @@ static void *dbuf_default_realloc(void *opaque, void *ptr, size_t size)
void dbuf_init2(DynBuf *s, void *opaque, DynBufReallocFunc *realloc_func)
{
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
if (!realloc_func)
realloc_func = dbuf_default_realloc;
s->opaque = opaque;
@ -150,7 +150,7 @@ void dbuf_free(DynBuf *s)
if (s->buf) {
s->realloc_func(s->opaque, s->buf, 0);
}
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
}
void dbuf_put_leb128(DynBuf *s, uint32_t v)

View file

@ -176,7 +176,7 @@ static inline slimb_t sat_add(slimb_t a, slimb_t b)
void bf_context_init(bf_context_t *s, bf_realloc_func_t *realloc_func,
void *realloc_opaque)
{
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
s->realloc_func = realloc_func;
s->realloc_opaque = realloc_opaque;
}
@ -1467,7 +1467,7 @@ static int mp_divnorm_large(bf_context_t *s,
tabt[i] = tabb[i + nb - n];
if (mp_add_ui(tabt, 1, n)) {
/* tabt = B^n : tabb_inv = B^n */
memset(tabb_inv, 0, n * sizeof(limb_t));
bzero(tabb_inv, n * sizeof(limb_t));
tabb_inv[n] = 1;
goto recip_done;
}
@ -1703,7 +1703,7 @@ static int __bf_div(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec,
if (!taba)
goto fail;
d = na - a->len;
memset(taba, 0, d * sizeof(limb_t));
bzero(taba, d * sizeof(limb_t));
memcpy(taba + d, a->tab, a->len * sizeof(limb_t));
if (bf_resize(r, n + 1))
goto fail1;
@ -2162,7 +2162,7 @@ int bf_sqrt(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags)
if (!a1)
goto fail;
n1 = bf_min(2 * n, a->len);
memset(a1, 0, (2 * n - n1) * sizeof(limb_t));
bzero(a1, (2 * n - n1) * sizeof(limb_t));
memcpy(a1 + 2 * n - n1, a->tab + a->len - n1, n1 * sizeof(limb_t));
if (a->expn & 1) {
res = mp_shr(a1, a1, 2 * n, 1, 0);
@ -3025,7 +3025,7 @@ static int bf_atof_internal(bf_t *r, slimb_t *pexponent,
/* reset the next limbs to zero (we prefer to reallocate in the
renormalization) */
memset(a->tab, 0, (pos + 1) * sizeof(limb_t));
bzero(a->tab, (pos + 1) * sizeof(limb_t));
if (p == p_start) {
ret = 0;
@ -4174,7 +4174,7 @@ static int bf_const_get(bf_t *T, limb_t prec, bf_flags_t flags,
static void bf_const_free(BFConstCache *c)
{
bf_delete(&c->val);
memset(c, 0, sizeof(*c));
bzero(c, sizeof(*c));
}
int bf_const_log2(bf_t *T, limb_t prec, bf_flags_t flags)
@ -6876,7 +6876,7 @@ static int __bfdec_div(bfdec_t *r, const bfdec_t *a, const bfdec_t *b,
if (!taba)
goto fail;
d = na - a->len;
memset(taba, 0, d * sizeof(limb_t));
bzero(taba, d * sizeof(limb_t));
memcpy(taba + d, a->tab, a->len * sizeof(limb_t));
if (bfdec_resize(r, n + 1))
goto fail1;
@ -7100,7 +7100,7 @@ int bfdec_sqrt(bfdec_t *r, const bfdec_t *a, limb_t prec, bf_flags_t flags)
if (!a1)
goto fail;
n1 = bf_min(2 * n, a->len);
memset(a1, 0, (2 * n - n1) * sizeof(limb_t));
bzero(a1, (2 * n - n1) * sizeof(limb_t));
memcpy(a1 + 2 * n - n1, a->tab + a->len - n1, n1 * sizeof(limb_t));
if (a->expn & 1) {
res = mp_shr_dec(a1, a1, 2 * n, 1, 0);
@ -8019,7 +8019,7 @@ static noinline void limb_to_ntt(BFNTTState *s,
(int64_t)i, taba[i]);
}
#endif
memset(tabr, 0, sizeof(NTTLimb) * fft_len * nb_mods);
bzero(tabr, sizeof(NTTLimb) * fft_len * nb_mods);
shift = dpl & (LIMB_BITS - 1);
if (shift == 0)
base_mask1 = -1;
@ -8099,7 +8099,7 @@ static noinline void ntt_to_limb(BFNTTState *s, limb_t *tabr, limb_t r_len,
carry[j] = 0;
for(j = 0; j < NB_MODS; j++)
u[j] = 0; /* avoid warnings */
memset(tabr, 0, sizeof(limb_t) * r_len);
bzero(tabr, sizeof(limb_t) * r_len);
fft_len = (limb_t)1 << fft_len_log2;
len = bf_min(fft_len, (r_len * LIMB_BITS + dpl - 1) / dpl);
len = (len + VEC_LEN - 1) & ~(VEC_LEN - 1);
@ -8201,7 +8201,7 @@ static noinline void ntt_to_limb(BFNTTState *s, limb_t *tabr, limb_t r_len,
carry[j] = 0;
for(j = 0; j < NB_MODS; j++)
u[j] = 0; /* avoid warnings */
memset(tabr, 0, sizeof(limb_t) * r_len);
bzero(tabr, sizeof(limb_t) * r_len);
fft_len = (limb_t)1 << fft_len_log2;
len = bf_min(fft_len, (r_len * LIMB_BITS + dpl - 1) / dpl);
for(i = 0; i < len; i++) {
@ -8291,7 +8291,7 @@ static int ntt_static_init(bf_context_t *s1)
#endif
if (!s)
return -1;
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
s1->ntt_state = s;
s->ctx = s1;

View file

@ -963,7 +963,7 @@ static int re_check_advance(const uint8_t *bc_buf, int bc_buf_len)
ret = -2; /* not known yet */
pos = 0;
has_back_reference = FALSE;
memset(capture_bitmap, 0, sizeof(capture_bitmap));
bzero(capture_bitmap, sizeof(capture_bitmap));
while (pos < bc_buf_len) {
opcode = bc_buf[pos];
@ -1832,7 +1832,7 @@ uint8_t *lre_compile(int *plen, char *error_msg, int error_msg_size,
int stack_size;
BOOL is_sticky;
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
s->opaque = opaque;
s->buf_ptr = (const uint8_t *)buf;
s->buf_end = s->buf_ptr + buf_len;

View file

@ -46,7 +46,7 @@ void js_parse_init(JSContext *ctx, JSParseState *s,
const char *input, size_t input_len,
const char *filename)
{
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
s->ctx = ctx;
s->filename = filename;
s->line_num = 1;
@ -5585,7 +5585,7 @@ static int add_arg(JSContext *ctx, JSFunctionDef *fd, JSAtom name)
&fd->arg_size, fd->arg_count + 1))
return -1;
vd = &fd->args[fd->arg_count++];
memset(vd, 0, sizeof(*vd));
bzero(vd, sizeof(*vd));
vd->var_name = JS_DupAtom(ctx, name);
vd->func_pool_idx = -1;
return fd->arg_count - 1;

View file

@ -498,7 +498,7 @@ int main(int argc, char **argv)
verbose = 0;
use_lto = FALSE;
stack_size = 0;
memset(&dynamic_module_list, 0, sizeof(dynamic_module_list));
bzero(&dynamic_module_list, sizeof(dynamic_module_list));
/* add system modules */
namelist_add(&cmodule_list, "std", "std", 0);
namelist_add(&cmodule_list, "os", "os", 0);

View file

@ -53,6 +53,8 @@ Copyright (c) 2017-2021 Fabrice Bellard\\n\
Copyright (c) 2017-2021 Charlie Gordon\"");
asm(".include \"libc/disclaimer.inc\"");
#define MAXPATH 1024
/* clang-format off */
/* TODO:
@ -499,7 +501,7 @@ int js_module_set_import_meta(JSContext *ctx, JSValueConst func_val,
JS_BOOL use_realpath, JS_BOOL is_main)
{
JSModuleDef *m;
char buf[PATH_MAX + 16];
char buf[MAXPATH + 16];
JSValue meta_obj;
JSAtom module_name_atom;
const char *module_name;
@ -1739,7 +1741,7 @@ static JSValue js_os_ttySetRaw(JSContext *ctx, JSValueConst this_val,
if (JS_ToInt32(ctx, &fd, argv[0]))
return JS_EXCEPTION;
memset(&tty, 0, sizeof(tty));
bzero(&tty, sizeof(tty));
tcgetattr(fd, &tty);
oldtty = tty;
@ -2367,7 +2369,7 @@ static JSValue make_string_error(JSContext *ctx,
static JSValue js_os_getcwd(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
char buf[PATH_MAX];
char buf[MAXPATH];
int err;
if (!getcwd(buf, sizeof(buf))) {
@ -2638,7 +2640,7 @@ static JSValue js_os_realpath(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
const char *path;
char buf[PATH_MAX], *res;
char buf[MAXPATH], *res;
int err;
path = JS_ToCString(ctx, argv[0]);
@ -2681,7 +2683,7 @@ static JSValue js_os_readlink(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
const char *path;
char buf[PATH_MAX];
char buf[MAXPATH];
int err;
ssize_t res;
@ -3309,7 +3311,7 @@ static JSValue js_worker_ctor(JSContext *ctx, JSValueConst new_target,
args = malloc(sizeof(*args));
if (!args)
goto oom_fail;
memset(args, 0, sizeof(*args));
bzero(args, sizeof(*args));
args->filename = strdup(filename);
args->basename = strdup(basename);
@ -3706,7 +3708,7 @@ void js_std_init_handlers(JSRuntime *rt)
fprintf(stderr, "Could not allocate memory for the worker");
exit(1);
}
memset(ts, 0, sizeof(*ts));
bzero(ts, sizeof(*ts));
init_list_head(&ts->os_rw_handlers);
init_list_head(&ts->os_signal_handlers);
init_list_head(&ts->os_timers);
@ -3718,7 +3720,7 @@ void js_std_init_handlers(JSRuntime *rt)
/* set the SharedArrayBuffer memory handlers */
{
JSSharedArrayBufferFunctions sf;
memset(&sf, 0, sizeof(sf));
bzero(&sf, sizeof(sf));
sf.sab_alloc = js_sab_alloc;
sf.sab_free = js_sab_free;
sf.sab_dup = js_sab_dup;

View file

@ -178,7 +178,8 @@ void *js_mallocz_rt(JSRuntime *rt, size_t size)
ptr = js_malloc_rt(rt, size);
if (!ptr)
return NULL;
return memset(ptr, 0, size);
bzero(ptr, size);
return ptr;
}
#ifdef CONFIG_BIGNUM
@ -352,7 +353,7 @@ int init_class_range(JSRuntime *rt, JSClassShortDef const *tab, int start, int c
int i, class_id;
for(i = 0; i < count; i++) {
class_id = i + start;
memset(cm, 0, sizeof(*cm));
bzero(cm, sizeof(*cm));
cm->finalizer = tab[i].finalizer;
cm->gc_mark = tab[i].gc_mark;
if (JS_NewClass1(rt, class_id, cm, tab[i].class_name) < 0)
@ -423,13 +424,13 @@ JSRuntime *JS_NewRuntime2(const JSMallocFunctions *mf, void *opaque)
{
JSRuntime *rt;
JSMallocState ms;
memset(&ms, 0, sizeof(ms));
bzero(&ms, sizeof(ms));
ms.opaque = opaque;
ms.malloc_limit = -1;
rt = mf->js_malloc(&ms, sizeof(JSRuntime));
if (!rt)
return NULL;
memset(rt, 0, sizeof(*rt));
bzero(rt, sizeof(*rt));
rt->mf = *mf;
if (!rt->mf.js_malloc_usable_size) {
/* use dummy function if none provided */
@ -1731,8 +1732,8 @@ static int JS_NewClass1(JSRuntime *rt, JSClassID class_id,
sizeof(JSClass) * new_size);
if (!new_class_array)
return -1;
memset(new_class_array + rt->class_count, 0,
(new_size - rt->class_count) * sizeof(JSClass));
bzero(new_class_array + rt->class_count,
(new_size - rt->class_count) * sizeof(JSClass));
rt->class_array = new_class_array;
rt->class_count = new_size;
}
@ -2089,8 +2090,8 @@ int resize_properties(JSContext *ctx, JSShape **psh, JSObject *p, uint32_t count
list_add_tail(&sh->header.link, &ctx->rt->gc_obj_list);
new_hash_mask = new_hash_size - 1;
sh->prop_hash_mask = new_hash_mask;
memset(prop_hash_end(sh) - new_hash_size, 0,
sizeof(prop_hash_end(sh)[0]) * new_hash_size);
bzero(prop_hash_end(sh) - new_hash_size,
sizeof(prop_hash_end(sh)[0]) * new_hash_size);
for(i = 0, pr = sh->prop; i < sh->prop_count; i++, pr++) {
if (pr->atom != JS_ATOM_NULL) {
h = ((uintptr_t)pr->atom & new_hash_mask);
@ -2144,8 +2145,8 @@ static int compact_properties(JSContext *ctx, JSObject *p)
list_del(&old_sh->header.link);
memcpy(sh, old_sh, sizeof(JSShape));
list_add_tail(&sh->header.link, &ctx->rt->gc_obj_list);
memset(prop_hash_end(sh) - new_hash_size, 0,
sizeof(prop_hash_end(sh)[0]) * new_hash_size);
bzero(prop_hash_end(sh) - new_hash_size,
sizeof(prop_hash_end(sh)[0]) * new_hash_size);
j = 0;
old_pr = old_sh->prop;
pr = sh->prop;
@ -7946,7 +7947,7 @@ int add_var(JSContext *ctx, JSFunctionDef *fd, JSAtom name)
&fd->var_size, fd->var_count + 1))
return -1;
vd = &fd->vars[fd->var_count++];
memset(vd, 0, sizeof(*vd));
bzero(vd, sizeof(*vd));
vd->var_name = JS_DupAtom(ctx, name);
vd->func_pool_idx = -1;
return fd->var_count - 1;
@ -8256,7 +8257,7 @@ static JSExportEntry *add_export_entry2(JSContext *ctx,
m->export_entries_count + 1))
return NULL;
me = &m->export_entries[m->export_entries_count++];
memset(me, 0, sizeof(*me));
bzero(me, sizeof(*me));
me->local_name = JS_DupAtom(ctx, local_name);
me->export_name = JS_DupAtom(ctx, export_name);
me->export_type = export_type;
@ -8757,7 +8758,7 @@ static JSValue js_build_module_ns(JSContext *ctx, JSModuleDef *m)
if (JS_IsException(obj))
return obj;
p = JS_VALUE_GET_OBJ(obj);
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
ret = get_exported_names(ctx, s, m, FALSE);
js_free(ctx, s->modules);
if (ret)
@ -14647,7 +14648,7 @@ static JSValue js_operators_create_internal(JSContext *ctx,
def->tab = new_tab;
def->count++;
ent = def->tab + def->count - 1;
memset(ent, 0, sizeof(def->tab[0]));
bzero(ent, sizeof(def->tab[0]));
ent->operator_index = op_count;
for(i = 0; i < JS_OVOP_BINARY_COUNT; i++) {
prop = JS_GetPropertyStr(ctx, arg,

View file

@ -109,6 +109,7 @@ THIRD_PARTY_QUICKJS_SRCS = \
third_party/quickjs/qjs.c \
third_party/quickjs/qjsc.c \
third_party/quickjs/run-test262.c \
third_party/quickjs/unicode_gen.c \
$(foreach x,$(THIRD_PARTY_QUICKJS_ARTIFACTS),$($(x)_SRCS))
THIRD_PARTY_QUICKJS_OBJS = \
@ -127,20 +128,15 @@ THIRD_PARTY_QUICKJS_CHECKS = \
$(THIRD_PARTY_QUICKJS_A).pkg \
$(THIRD_PARTY_QUICKJS_A_HDRS:%=o/$(MODE)/%.ok)
o/$(MODE)/third_party/quickjs/qjsc: \
o/$(MODE)/third_party/quickjs/qjsc.com
@cp -f $< $@
@$@ -n
o/$(MODE)/third_party/quickjs/qjscalc.c: \
third_party/quickjs/qjscalc.js \
o/$(MODE)/third_party/quickjs/qjsc
o/$(MODE)/third_party/quickjs/qjsc -fbignum -o $@ -c $<
o/$(MODE)/third_party/quickjs/qjsc.com
@$(COMPILE) -AQJSC o/$(MODE)/third_party/quickjs/qjsc.com -fbignum -o $@ -c $<
o/$(MODE)/third_party/quickjs/repl.c: \
third_party/quickjs/repl.js \
o/$(MODE)/third_party/quickjs/qjsc
o/$(MODE)/third_party/quickjs/qjsc -o $@ -m -c $<
o/$(MODE)/third_party/quickjs/qjsc.com
@$(COMPILE) -AQJSC o/$(MODE)/third_party/quickjs/qjsc.com -o $@ -m -c $<
o/$(MODE)/third_party/quickjs/qjs.com.dbg: \
$(THIRD_PARTY_QUICKJS) \
@ -149,14 +145,14 @@ o/$(MODE)/third_party/quickjs/qjs.com.dbg: \
o/$(MODE)/third_party/quickjs/qjscalc.o \
$(CRT) \
$(APE)
-@$(APELINK)
@$(APELINK)
o/$(MODE)/third_party/quickjs/qjsc.com.dbg: \
$(THIRD_PARTY_QUICKJS) \
o/$(MODE)/third_party/quickjs/qjsc.o \
$(CRT) \
$(APE)
-@$(APELINK)
@$(APELINK)
# git clone git@github.com:tc39/test262 /opt/test262
# make -j8 MODE=dbg o/dbg/third_party/quickjs/run-test262.com
@ -168,7 +164,7 @@ o/$(MODE)/third_party/quickjs/run-test262.com.dbg: \
o/$(MODE)/third_party/quickjs/run-test262.o \
$(CRT) \
$(APE)
-@$(APELINK)
@$(APELINK)
o/$(MODE)/third_party/quickjs/unicode_gen.com.dbg: \
$(THIRD_PARTY_QUICKJS_A_DEPS) \
@ -177,7 +173,7 @@ o/$(MODE)/third_party/quickjs/unicode_gen.com.dbg: \
o/$(MODE)/third_party/quickjs/unicode_gen.o \
$(CRT) \
$(APE)
-@$(APELINK)
@$(APELINK)
$(THIRD_PARTY_QUICKJS_OBJS): \
OVERRIDE_CPPFLAGS += \

View file

@ -548,7 +548,7 @@ static JSValue js_agent_start(JSContext *ctx, JSValue this_val,
if (!script)
return JS_EXCEPTION;
agent = malloc(sizeof(*agent));
memset(agent, 0, sizeof(*agent));
bzero(agent, sizeof(*agent));
agent->broadcast_func = JS_UNDEFINED;
agent->broadcast_sab = JS_UNDEFINED;
agent->script = strdup(script);

View file

@ -130,7 +130,7 @@ JSShape *js_new_shape2(JSContext *ctx, JSObject *proto, int hash_size, int prop_
if (proto)
JS_DupValue(ctx, JS_MKPTR(JS_TAG_OBJECT, proto));
sh->proto = proto;
memset(prop_hash_end(sh) - hash_size, 0, sizeof(prop_hash_end(sh)[0]) *
bzero(prop_hash_end(sh) - hash_size, sizeof(prop_hash_end(sh)[0]) *
hash_size);
sh->prop_hash_mask = hash_size - 1;
sh->prop_size = prop_size;

View file

@ -1816,7 +1816,7 @@ JSValue js_array_buffer_constructor3(JSContext *ctx,
max_int(len, 1));
if (!abuf->data)
goto fail;
memset(abuf->data, 0, len);
bzero(abuf->data, len);
} else {
/* the allocation must be done after the object creation */
abuf->data = js_mallocz(ctx, max_int(len, 1));

View file

@ -76,7 +76,7 @@ void *mallocz(size_t size)
{
void *ptr;
ptr = malloc(size);
memset(ptr, 0, size);
bzero(ptr, size);
return ptr;
}
@ -2487,7 +2487,7 @@ void add_decomp_data(uint8_t *data_buf, int *pidx, DecompEntry *de)
int n, p, k;
n = (de->len * de->c_len * 18 + 7) / 8;
p = de->len * de->c_len * 2;
memset(data_buf + idx, 0, n);
bzero(data_buf + idx, n);
k = 0;
for(i = 0; i < de->len; i++) {
ci = &unicode_db[de->code + i];

View file

@ -116,7 +116,7 @@ void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s)
struct list_head *el, *el1;
int i;
JSMemoryUsage_helper mem = { 0 }, *hp = &mem;
memset(s, 0, sizeof(*s));
bzero(s, sizeof(*s));
s->malloc_count = rt->malloc_state.malloc_count;
s->malloc_size = rt->malloc_state.malloc_size;
s->malloc_limit = rt->malloc_state.malloc_limit;