mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
buffer: move SlowBuffer to EOL
This commits reverts da69d13623
PR-URL: https://github.com/nodejs/node/pull/58220
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
e4e80c5463
commit
daced4ab98
23 changed files with 61 additions and 118 deletions
|
@ -52,7 +52,6 @@ const {
|
|||
TypedArrayPrototypeSet,
|
||||
TypedArrayPrototypeSlice,
|
||||
Uint8Array,
|
||||
Uint8ArrayPrototype,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
|
@ -89,7 +88,6 @@ const {
|
|||
kIsEncodingSymbol,
|
||||
defineLazyProperties,
|
||||
encodingsMap,
|
||||
deprecate,
|
||||
} = require('internal/util');
|
||||
const {
|
||||
isAnyArrayBuffer,
|
||||
|
@ -411,25 +409,15 @@ Buffer.allocUnsafe = function allocUnsafe(size) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled
|
||||
* Buffer instance that is not allocated off the pre-initialized pool.
|
||||
* If `--zero-fill-buffers` is set, will zero-fill the buffer.
|
||||
* By default creates a non-zero-filled Buffer instance that is not allocated
|
||||
* off the pre-initialized pool. If `--zero-fill-buffers` is set, will zero-fill
|
||||
* the buffer.
|
||||
*/
|
||||
Buffer.allocUnsafeSlow = function allocUnsafeSlow(size) {
|
||||
validateNumber(size, 'size', 0, kMaxLength);
|
||||
return createUnsafeBuffer(size);
|
||||
};
|
||||
|
||||
// If --zero-fill-buffers command line argument is set, a zero-filled
|
||||
// buffer is returned.
|
||||
function SlowBuffer(size) {
|
||||
validateNumber(size, 'size', 0, kMaxLength);
|
||||
return createUnsafeBuffer(size);
|
||||
}
|
||||
|
||||
ObjectSetPrototypeOf(SlowBuffer.prototype, Uint8ArrayPrototype);
|
||||
ObjectSetPrototypeOf(SlowBuffer, Uint8Array);
|
||||
|
||||
function allocate(size) {
|
||||
if (size <= 0) {
|
||||
return new FastBuffer();
|
||||
|
@ -1331,10 +1319,6 @@ function isAscii(input) {
|
|||
|
||||
module.exports = {
|
||||
Buffer,
|
||||
SlowBuffer: deprecate(
|
||||
SlowBuffer,
|
||||
'SlowBuffer() is deprecated. Please use Buffer.allocUnsafeSlow()',
|
||||
'DEP0030'),
|
||||
transcode,
|
||||
isUtf8,
|
||||
isAscii,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue