You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
454 B

/*
* duk_hstring assertion helpers.
*/
#include "duk_internal.h"
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL void duk_hstring_assert_valid(duk_hstring *h) {
DUK_ASSERT(h != NULL);
if (DUK_HSTRING_HAS_SYMBOL(h)) {
/* XXX: add checks here. */
} else {
const duk_uint8_t *str = duk_hstring_get_data(h);
duk_size_t blen = duk_hstring_get_bytelen(h);
DUK_ASSERT(duk_unicode_is_valid_wtf8(str, blen));
}
}
#endif /* DUK_USE_ASSERTIONS */