Skip to content

Commit

Permalink
sea: move flags before code in SeaResource struct
Browse files Browse the repository at this point in the history
Refs: nodejs#47588 (comment)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
RaisinTen committed Apr 26, 2023
1 parent 22cb244 commit ce5e999
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/node_sea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ SeaFlags operator|=(/* NOLINT (runtime/references) */ SeaFlags& x, SeaFlags y) {
}

struct SeaResource {
std::string_view code;
SeaFlags flags = SeaFlags::kDefault;
std::string_view code;
};

SeaResource FindSingleExecutableResource() {
Expand All @@ -83,9 +83,13 @@ SeaResource FindSingleExecutableResource() {
SeaFlags flags{
reinterpret_cast<const SeaFlags*>(code + sizeof(first_word))[0]};
// TODO(joyeecheung): do more checks here e.g. matching the versions.
return {{code + sizeof(first_word) + sizeof(flags),
size - sizeof(first_word) - sizeof(flags)},
flags};
return {
flags,
{
code + sizeof(first_word) + sizeof(flags),
size - sizeof(first_word) - sizeof(flags),
},
};
}();
return sea_resource;
}
Expand Down

0 comments on commit ce5e999

Please sign in to comment.