Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
duk_hobject_misc.c File Reference
#include "duk_internal.h"

Go to the source code of this file.

Functions

DUK_INTERNAL duk_bool_t duk_hobject_prototype_chain_contains (duk_hthread *thr, duk_hobject *h, duk_hobject *p, duk_bool_t ignore_loop)
 
DUK_INTERNAL void duk_hobject_set_prototype_updref (duk_hthread *thr, duk_hobject *h, duk_hobject *p)
 

Function Documentation

◆ duk_hobject_prototype_chain_contains()

DUK_INTERNAL duk_bool_t duk_hobject_prototype_chain_contains ( duk_hthread * thr,
duk_hobject * h,
duk_hobject * p,
duk_bool_t ignore_loop )

Definition at line 7 of file duktape-1.5.2/src-separate/duk_hobject_misc.c.

7 {
8 duk_uint_t sanity;
9
10 DUK_ASSERT(thr != NULL);
11
12 /* False if the object is NULL or the prototype 'p' is NULL.
13 * In particular, false if both are NULL (don't compare equal).
14 */
15 if (h == NULL || p == NULL) {
16 return 0;
17 }
18
20 do {
21 if (h == p) {
22 return 1;
23 }
24
25 if (sanity-- == 0) {
26 if (ignore_loop) {
27 break;
28 } else {
30 }
31 }
33 } while (h);
34
35 return 0;
36}
duk_uint_fast32_t duk_uint_t
#define DUK_ERROR_RANGE(thr, msg)
#define DUK_HOBJECT_GET_PROTOTYPE(heap, h)
#define DUK_STR_PROTOTYPE_CHAIN_LIMIT
#define DUK_HOBJECT_PROTOTYPE_CHAIN_SANITY
#define NULL
Definition gmacros.h:924

References DUK_ASSERT, DUK_ERROR_RANGE, DUK_HOBJECT_GET_PROTOTYPE, DUK_HOBJECT_PROTOTYPE_CHAIN_SANITY, DUK_STR_PROTOTYPE_CHAIN_LIMIT, duk_hthread::heap, and NULL.

◆ duk_hobject_set_prototype_updref()

DUK_INTERNAL void duk_hobject_set_prototype_updref ( duk_hthread * thr,
duk_hobject * h,
duk_hobject * p )

Definition at line 38 of file duktape-1.5.2/src-separate/duk_hobject_misc.c.

38 {
39#ifdef DUK_USE_REFERENCE_COUNTING
40 duk_hobject *tmp;
41
42 DUK_ASSERT(h);
43 tmp = DUK_HOBJECT_GET_PROTOTYPE(thr->heap, h);
45 DUK_HOBJECT_INCREF_ALLOWNULL(thr, p); /* avoid problems if p == h->prototype */
47#else
48 DUK_ASSERT(h);
49 DUK_UNREF(thr);
51#endif
52}
#define DUK_HOBJECT_DECREF_ALLOWNULL(thr, h)
#define DUK_HOBJECT_SET_PROTOTYPE(heap, h, x)
#define DUK_HOBJECT_INCREF_ALLOWNULL(thr, h)

References DUK_ASSERT, DUK_HOBJECT_DECREF_ALLOWNULL, DUK_HOBJECT_GET_PROTOTYPE, DUK_HOBJECT_INCREF_ALLOWNULL, DUK_HOBJECT_SET_PROTOTYPE, DUK_UNREF, and duk_hthread::heap.