node/lib/smalloc.js
Ben Noordhuis d5ce47e433 lib: deprecate the smalloc module
Upcoming V8 changes will make it impossible to keep supporting the
smalloc module so deprecate it now and tell people to switch to
typed arrays.

The module is used in core in a few places so this commit makes the
public module private and replaces the public part with wrappers that
print deprecation notices.

PR-URL: https://github.com/iojs/io.js/pull/1564
Reviewed-By: Domenic Denicola <domenic@domenicdenicola.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-04-29 19:33:43 +02:00

27 lines
803 B
JavaScript

'use strict';
const smalloc = require('internal/smalloc');
const deprecate = require('util').deprecate;
exports.alloc =
deprecate(smalloc.alloc, 'smalloc.alloc: Deprecated, use typed arrays');
exports.copyOnto =
deprecate(smalloc.copyOnto,
'smalloc.copyOnto: Deprecated, use typed arrays');
exports.dispose =
deprecate(smalloc.dispose,
'smalloc.dispose: Deprecated, use typed arrays');
exports.hasExternalData =
deprecate(smalloc.hasExternalData,
'smalloc.hasExternalData: Deprecated, use typed arrays');
Object.defineProperty(exports, 'kMaxLength', {
enumerable: true, value: smalloc.kMaxLength, writable: false
});
Object.defineProperty(exports, 'Types', {
enumerable: true, value: Object.freeze(smalloc.Types), writable: false
});