File: bigstring-core_kernel.js

package info (click to toggle)
js-of-ocaml 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,372 kB
  • sloc: ml: 70,468; javascript: 8,238; ansic: 319; makefile: 217; lisp: 23; sh: 6; perl: 4
file content (16 lines) | stat: -rw-r--r-- 590 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//The following are defined in Core_kernel
//There are just provided here for compatibility reasons

//Provides: bigstring_destroy_stub
//Requires: caml_invalid_argument, caml_ba_create_unsafe
//Weakdef
function bigstring_destroy_stub(v_bstr) {
  if (v_bstr.hasOwnProperty('__is_deallocated')) {
    caml_invalid_argument("bigstring_destroy: bigstring is already deallocated");
  }
  // Mutate the original bigstring in-place, to simulate what the C version does
  v_bstr.__is_deallocated = true;
  v_bstr.data = new v_bstr.data.__proto__.constructor(0);
  v_bstr.dims = [0];
  return 0;
}