Skip to content

Commit

Permalink
Export js_truthy()
Browse files Browse the repository at this point in the history
  • Loading branch information
cpq committed Nov 18, 2023
1 parent 9112ce0 commit e236f96
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion elk.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ const char *js_str(struct js *js, jsval_t value) {
return buf;
}

static bool js_truthy(struct js *js, jsval_t v) {
bool js_truthy(struct js *js, jsval_t v) {
uint8_t t = vtype(v);
return (t == T_BOOL && vdata(v) != 0) || (t == T_NUM && tod(v) != 0.0) ||
(t == T_OBJ || t == T_FUNC) || (t == T_STR && vstrlen(js, v) > 0);
Expand Down
1 change: 1 addition & 0 deletions elk.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jsval_t js_eval(struct js *, const char *, size_t); // Execute JS code
jsval_t js_glob(struct js *); // Return global object
const char *js_str(struct js *, jsval_t val); // Stringify JS value
bool js_chkargs(jsval_t *, int, const char *); // Check args validity
bool js_truthy(struct js *, jsval_t); // Check if value is true
void js_setmaxcss(struct js *, size_t); // Set max C stack size
void js_setgct(struct js *, size_t); // Set GC trigger threshold
void js_stats(struct js *, size_t *total, size_t *min, size_t *cstacksize);
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CFLAGS ?= -W -Wall -Wextra -Werror -Wno-deprecated -I.. \
CWD ?= $(realpath $(CURDIR))
ROOT ?= $(realpath $(CURDIR)/..)
DOCKER = docker run $(DA) --rm -e WINEDEBUG=-all -v $(ROOT):$(ROOT) -w $(CWD)
ARCH_FLAGS ?= -Wformat-truncation
ARCH_FLAGS ?= #-Wformat-truncation
DESTDIR ?= .

define clean
Expand Down

0 comments on commit e236f96

Please sign in to comment.