Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7539070
roots.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
866 B
Referenced Files
None
Subscribers
None
roots.c
View Options
#include
"ant.h"
#include
"gc.h"
#include
"arena.h"
#include
"internal.h"
jshdl_t
js_root
(
struct
js
*
js
,
jsval_t
val
)
{
if
(
js
->
gc_roots_len
>=
js
->
gc_roots_cap
)
{
int
new_cap
=
js
->
gc_roots_cap
?
js
->
gc_roots_cap
*
2
:
GC_ROOTS_INITIAL_CAP
;
jsval_t
*
new_roots
=
ant_realloc
(
js
->
gc_roots
,
new_cap
*
sizeof
(
jsval_t
));
if
(
!
new_roots
)
return
-1
;
js
->
gc_roots
=
new_roots
;
js
->
gc_roots_cap
=
new_cap
;
}
int
idx
=
js
->
gc_roots_len
++
;
js
->
gc_roots
[
idx
]
=
val
;
return
idx
;
}
jsval_t
js_deref
(
struct
js
*
js
,
jshdl_t
h
)
{
if
(
h
<
0
||
h
>=
js
->
gc_roots_len
)
return
js_mkundef
();
return
js
->
gc_roots
[
h
];
}
void
js_unroot
(
struct
js
*
js
,
jshdl_t
h
)
{
if
(
h
>=
0
&&
h
==
js
->
gc_roots_len
-
1
)
js
->
gc_roots_len
--
;
}
void
js_root_update
(
struct
js
*
js
,
jshdl_t
h
,
jsval_t
val
)
{
if
(
h
>=
0
&&
h
<
js
->
gc_roots_len
)
js
->
gc_roots
[
h
]
=
val
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Wed, Jun 17, 1:12 PM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
536771
Default Alt Text
roots.c (866 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment