about summary refs log tree commit diff stats
path: root/lib/quickjs/cutils.h
diff options
context:
space:
mode:
authorCharlie Gordon <github@chqrlie.org>2024-03-22 00:47:17 +0100
committerbptato <nincsnevem662@gmail.com>2024-04-14 19:00:24 +0200
commit07f88ea2a567faf1501af1563de2336c296f7e49 (patch)
treebc26e76a5150c6c38dec962ec2ddcd8ef5a87a1c /lib/quickjs/cutils.h
parentffa46fbb1cd4d3104f27d9fe55a0ac5520aa93ca (diff)
downloadchawan-07f88ea2a567faf1501af1563de2336c296f7e49.tar.gz
Improve Date.parse, small fixes
- add `minimum_length` to enforce array length validation
- add `JS_NewDate()` API
- add `[Symbol.toStringTag]` property in the global object
- simplify `string_get_milliseconds`
- support more timezone abbrevs using `string_get_tzabbr` and array
Diffstat (limited to 'lib/quickjs/cutils.h')
-rw-r--r--lib/quickjs/cutils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/quickjs/cutils.h b/lib/quickjs/cutils.h
index 11246e3c..f079e5c5 100644
--- a/lib/quickjs/cutils.h
+++ b/lib/quickjs/cutils.h
@@ -51,6 +51,12 @@
 #define container_of(ptr, type, member) ((type *)((uint8_t *)(ptr) - offsetof(type, member)))
 #endif
 
+#if !defined(_MSC_VER) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define minimum_length(n)  static n
+#else
+#define minimum_length(n)  n
+#endif
+
 typedef int BOOL;
 
 #ifndef FALSE