Skip to content

Commit

Permalink
src: reduce variable scope in module_wrap.cc
Browse files Browse the repository at this point in the history
PR-URL: #23297
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
cjihrig authored and targos committed Oct 10, 2018
1 parent 402867c commit 902ba0e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -433,16 +433,15 @@ std::string ReadFile(uv_file file) {
uv_fs_t req;
char buffer_memory[4096];
uv_buf_t buf = uv_buf_init(buffer_memory, sizeof(buffer_memory));
int r;

do {
r = uv_fs_read(uv_default_loop(),
&req,
file,
&buf,
1,
contents.length(), // offset
nullptr);
const int r = uv_fs_read(uv_default_loop(),
&req,
file,
&buf,
1,
contents.length(), // offset
nullptr);
uv_fs_req_cleanup(&req);

if (r <= 0)
Expand Down

0 comments on commit 902ba0e

Please sign in to comment.