aboutsummaryrefslogtreecommitdiff
path: root/src/snippets.js
blob: b9f6267f4e17afa8862403c9871546add09606f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var Snippets = {
  _vsnprintf: function(dst, num, src, ptr) {
    var args = [];
    while (HEAP[ptr] != 0) {
      args.push(HEAP[ptr]);
      ptr ++;
    }
    var text = __formatString.apply(null, [src].concat(args));
    for (var i = 0; i < num; i++) {
      HEAP[dst+i] = HEAP[text+i];
      if (HEAP[dst+i] == 0) break;
    }
  },

  _atexit: function(func) {
    __ATEXIT__.push(func);
  },
};

// Synonyms
Snippets.___cxa_atexit = Snippets._atexit;