summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2018-09-23 21:30:08 -0400
committerRefael Ackermann <refack@gmail.com>2018-10-24 11:52:15 -0400
commitfb897fbae0ed88593269afe320ece9340b0ec713 (patch)
tree783d5aed743742445fad05f413137d3e9a3e9b4b /src/env.h
parent6786ff4d3688512d8b717ec24188818ac5493d0b (diff)
downloadandroid-node-v8-fb897fbae0ed88593269afe320ece9340b0ec713.tar.gz
android-node-v8-fb897fbae0ed88593269afe320ece9340b0ec713.tar.bz2
android-node-v8-fb897fbae0ed88593269afe320ece9340b0ec713.zip
src: refactor FillStatsArray
PR-URL: https://github.com/nodejs/node/pull/23793 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/env.h')
-rw-r--r--src/env.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/env.h b/src/env.h
index 36e4169b4b..af2dbd32a5 100644
--- a/src/env.h
+++ b/src/env.h
@@ -84,9 +84,12 @@ struct PackageConfig {
// The number of items passed to push_values_to_array_function has diminishing
// returns around 8. This should be used at all call sites using said function.
-#ifndef NODE_PUSH_VAL_TO_ARRAY_MAX
-#define NODE_PUSH_VAL_TO_ARRAY_MAX 8
-#endif
+constexpr size_t NODE_PUSH_VAL_TO_ARRAY_MAX = 8;
+
+// Stat fields buffers contain twice the number of entries in an uv_stat_t
+// because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances.
+constexpr size_t kFsStatsFieldsNumber = 14;
+constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;
// PER_ISOLATE_* macros: We have a lot of per-isolate properties
// and adding and maintaining their getters and setters by hand would be
@@ -710,10 +713,6 @@ class Environment {
inline AliasedBuffer<uint64_t, v8::BigUint64Array>*
fs_stats_field_bigint_array();
- // stat fields contains twice the number of entries because `fs.StatWatcher`
- // needs room to store data for *two* `fs.Stats` instances.
- static const int kFsStatsFieldsLength = 14;
-
inline std::vector<std::unique_ptr<fs::FileHandleReadWrap>>&
file_handle_read_wrap_freelist();