diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1996-12-10 15:41:11 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1996-12-10 15:41:11 +0000 |
commit | 09064ccb028527a2f72f3a8937db9ee69151ae70 (patch) | |
tree | 111ec2d3f0e77298391de7abe8e5994b9aeca438 | |
parent | 5f86e94e180897f37889dc4baff005674288b8b4 (diff) |
Ajout de remove_global_root.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1220 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | byterun/memory.h | 8 | ||||
-rw-r--r-- | byterun/roots.c | 16 |
2 files changed, 23 insertions, 1 deletions
diff --git a/byterun/memory.h b/byterun/memory.h index 252873e57..95f0a6c99 100644 --- a/byterun/memory.h +++ b/byterun/memory.h @@ -97,10 +97,16 @@ extern value *local_roots; #define Pop_roots() {local_roots = (value *) local_roots [1]; } /* [register_global_root] registers a global C variable as a memory root - for the duration of the program. */ + for the duration of the program, or until [remove_global_root] is + called. */ void register_global_root P((value *)); +/* [remove_global_root] removes a memory root registered on a global C + variable with [register_global_root]. */ + +void remove_global_root P((value *)); + #endif /* _memory_ */ diff --git a/byterun/roots.c b/byterun/roots.c index a9dfd2065..055b7c763 100644 --- a/byterun/roots.c +++ b/byterun/roots.c @@ -44,6 +44,22 @@ void register_global_root(r) global_roots = gr; } +/* Un-register a global C root */ + +void remove_global_root(r) + value * r; +{ + struct global_root ** gp, * gr; + for (gp = &global_roots; *gp != NULL; gp = &(*gp)->next) { + gr = *gp; + if (gr->root == r) { + *gp = gr->next; + stat_free((char *) gr); + return; + } + } +} + /* Call [oldify] on all roots except [global_data] */ void oldify_local_roots () |