GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: move windows specific fns to `_WIN32` · nodejs/node@2877207

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • util-inl.h
    • util.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/util-inl.h‎

Copy file name to clipboardExpand all lines: src/util-inl.h
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@
2828
#include <cstring>
2929
#include <locale>
3030
#include <ranges>
31-
#include <regex> // NOLINT(build/c++11)
3231
#include "node_revert.h"
3332
#include "util.h"
3433

34+
#ifdef _WIN32
35+
#include <regex> // NOLINT(build/c++11)
36+
#endif // _WIN32
37+
3538
#define CHAR_TEST(bits, name, expr) \
3639
template <typename T> \
3740
bool name(const T ch) { \
@@ -588,9 +591,8 @@ constexpr std::string_view FastStringKey::as_string_view() const {
588591
return name_;
589592
}
590593

591-
// Inline so the compiler can fully optimize it away on Unix platforms.
592-
bool IsWindowsBatchFile(const char* filename) {
593594
#ifdef _WIN32
595+
inline bool IsWindowsBatchFile(const char* filename) {
594596
std::string file_with_extension = filename;
595597
// Regex to match the last extension part after the last dot, ignoring
596598
// trailing spaces and dots
@@ -603,12 +605,8 @@ bool IsWindowsBatchFile(const char* filename) {
603605
}
604606

605607
return !extension.empty() && (extension == "cmd" || extension == "bat");
606-
#else
607-
return false;
608-
#endif // _WIN32
609608
}
610609

611-
#ifdef _WIN32
612610
inline std::wstring ConvertToWideString(const std::string& str,
613611
UINT code_page) {
614612
int size_needed = MultiByteToWideChar(
Collapse file

‎src/util.h‎

Copy file name to clipboardExpand all lines: src/util.h
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,9 +1026,12 @@ v8::Maybe<int> GetValidFileMode(Environment* env,
10261026
v8::Local<v8::Value> input,
10271027
uv_fs_type type);
10281028

1029+
#ifdef _WIN32
10291030
// Returns true if OS==Windows and filename ends in .bat or .cmd,
10301031
// case insensitive.
10311032
inline bool IsWindowsBatchFile(const char* filename);
1033+
inline std::wstring ConvertToWideString(const std::string& str, UINT code_page);
1034+
#endif // _WIN32
10321035

10331036
} // namespace node
10341037

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.