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 <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gabriel Schulhof <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • 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.