Skip to content

Commit

Permalink
Lazy load a few modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Jul 28, 2011
1 parent ea9ee1f commit 8527f00
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
9 changes: 4 additions & 5 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

var SlowBuffer = process.binding('buffer').SlowBuffer;
var IEEE754 = require('buffer_ieee754');
var assert = require('assert');


Expand Down Expand Up @@ -741,7 +740,7 @@ Buffer.prototype.readFloat = function(offset, endian) {
assert.ok(offset + 3 < buffer.length,
'Trying to read beyond buffer length');

return IEEE754.readIEEE754(buffer, offset, endian, 23, 4);
return require('buffer_ieee754').readIEEE754(buffer, offset, endian, 23, 4);
};

Buffer.prototype.readDouble = function(offset, endian) {
Expand All @@ -759,7 +758,7 @@ Buffer.prototype.readDouble = function(offset, endian) {
assert.ok(offset + 7 < buffer.length,
'Trying to read beyond buffer length');

return IEEE754.readIEEE754(buffer, offset, endian, 52, 8);
return require('buffer_ieee754').readIEEE754(buffer, offset, endian, 52, 8);
};


Expand Down Expand Up @@ -1035,7 +1034,7 @@ Buffer.prototype.writeFloat = function(value, offset, endian) {
'Trying to write beyond buffer length');

verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38);
IEEE754.writeIEEE754(buffer, value, offset, endian, 23, 4);
require('buffer_ieee754').writeIEEE754(buffer, value, offset, endian, 23, 4);
};


Expand All @@ -1058,6 +1057,6 @@ Buffer.prototype.writeDouble = function(value, offset, endian) {
'Trying to write beyond buffer length');

verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308);
IEEE754.writeIEEE754(buffer, value, offset, endian, 52, 8);
require('buffer_ieee754').writeIEEE754(buffer, value, offset, endian, 52, 8);
};

5 changes: 2 additions & 3 deletions lib/tty_posix.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

var binding = process.binding('stdio'),
net = require('net_legacy'), // FIXME
inherits = require('util').inherits,
spawn = require('child_process').spawn;
inherits = require('util').inherits;


exports.open = function(path, args) {
Expand All @@ -42,7 +41,7 @@ exports.open = function(path, args) {
stream.resume();


child = spawn(path, args, {
child = require('child_process').spawn(path, args, {
env: env,
customFds: [masterFD, masterFD, masterFD],
setsid: true
Expand Down
3 changes: 0 additions & 3 deletions test/simple/test-module-load-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ var expected = [
'NativeModule events',
'NativeModule buffer',
'Binding buffer',
'NativeModule buffer_ieee754', // FIXME should not be loading
'NativeModule assert',
'NativeModule util',
'Binding stdio',
Expand Down Expand Up @@ -70,8 +69,6 @@ expected = expected.concat([
'Binding io_watcher',
'NativeModule tty',
'NativeModule tty_posix', // FIXME branch on win32 here.
'NativeModule child_process', // FIXME should not be loading
'Binding child_process' // FIXME should not be loading
]);

checkExpected();
Expand Down

0 comments on commit 8527f00

Please sign in to comment.