fs: minor refactoring
authorSakthipriyan Vairamani <thechargingvolcano@gmail.com>
Tue, 2 Jun 2015 22:11:04 +0000 (03:41 +0530)
committerTrevor Norris <trev.norris@gmail.com>
Wed, 10 Jun 2015 22:56:25 +0000 (16:56 -0600)
commita011c3243f6f1508c5b3412659db829b73e08867
treeb976c4bc163e5eb817f0625b6ced507a0bc1c068
parent8841132f30e2e35c2dcc6c724f1507aa3e1c1175
fs: minor refactoring

1. Remove a few unnecessary variables to reduce LoC.

2. Remove redundant `var` definitions of variables in same function.

3. Refactor variables which are defined inside a block and used outside
as well.

4. Refactor effect-less code.

5. In `rethrow` function, instead of assigning to `err` and throwing
`err` directly throw `backtrace` object.

6. Reassign a defined parameter while also mentioning arguments in the
body is one of the optimization killers. So, changing `callback` to
`callback_` and declaring a new variable called `callback` in the body.

PR-URL: https://github.com/nodejs/io.js/pull/1870
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
lib/fs.js