0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-06-30 22:19:29 -04:00

Add some assertions.

This commit is contained in:
Miciah Dashiel Butler Masters 2005-12-19 21:24:27 +00:00 committed by Miciah Dashiel Butler Masters
parent 5ca5381fbc
commit 11c90e7205
3 changed files with 10 additions and 0 deletions

View File

@ -74,6 +74,8 @@ smjs_load_hooks(void)
struct string script;
unsigned char *path;
assert(smjs_ctx);
if (!init_string(&script)) return;
if (elinks_home) {

View File

@ -47,6 +47,9 @@ static const JSFunctionSpec elinks_funcs[] = {
JSObject *
smjs_get_elinks_object(JSObject *global_object)
{
assert(smjs_ctx);
assert(global_object);
return JS_InitClass(smjs_ctx, global_object, NULL,
(JSClass *) &elinks_class, NULL, 0, NULL,
(JSFunctionSpec *) elinks_funcs, NULL, NULL);

View File

@ -24,6 +24,11 @@ call_script_hook(unsigned char *hook, jsval argv[], int argc, jsval *rval)
{
JSFunction *func;
assert(smjs_ctx);
assert(smjs_elinks_object);
assert(rval);
assert(argv);
if (JS_FALSE == JS_GetProperty(smjs_ctx, smjs_elinks_object,
hook, rval))
return JS_FALSE;