summaryrefslogtreecommitdiffstats
path: root/byterun/alloc.c
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>1997-05-26 17:16:31 +0000
committerDamien Doligez <damien.doligez-inria.fr>1997-05-26 17:16:31 +0000
commit8555ce8fe79fbf54924845a608054306733eeeba (patch)
treedd5b22190a08dcf3c1d8c16adc89988b60d982f1 /byterun/alloc.c
parentff13e60cd68933428c60c10680c82c3cd91ea8c2 (diff)
Changement de Push/Pop_roots en Begin/End_roots
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1572 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/alloc.c')
-rw-r--r--byterun/alloc.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/byterun/alloc.c b/byterun/alloc.c
index ace6f6635..c2c4ccf1b 100644
--- a/byterun/alloc.c
+++ b/byterun/alloc.c
@@ -92,24 +92,24 @@ value alloc_array(funct, arr)
char ** arr;
{
mlsize_t nbr, n;
- value v;
+ value v, result;
nbr = 0;
while (arr[nbr] != 0) nbr++;
if (nbr == 0) {
return Atom(0);
} else {
- Push_roots(r, 1);
- r[0] = nbr < Max_young_wosize ? alloc(nbr, 0) : alloc_shr(nbr, 0);
- for (n = 0; n < nbr; n++)
- Field(r[0], n) = Val_int(0);
- for (n = 0; n < nbr; n++) {
- v = funct(arr[n]);
- modify(&Field(r[0], n), v);
- }
- v = r[0];
- Pop_roots();
- return v;
+ result = nbr < Max_young_wosize ? alloc(nbr, 0) : alloc_shr(nbr, 0);
+ for (n = 0; n < nbr; n++) Field(result, n) = Val_int(0);
+ Begin_root(result);
+ for (n = 0; n < nbr; n++) {
+ /* The two statements below must be separate because of evaluation
+ order. */
+ v = funct(arr[n]);
+ modify(&Field(result, n), v);
+ }
+ End_roots();
+ return result;
}
}