Skip to content

Commit

Permalink
Use std::cerr instead of std::clog
Browse files Browse the repository at this point in the history
  • Loading branch information
phst committed Dec 23, 2021
1 parent 2a2ba7d commit 780d8d8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion elisp/binary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int RunBinary(const NativeString& argv0,
const std::vector<NativeString>& args) {
const absl::StatusOr<int> status_or_code = RunBinaryImpl(argv0, args);
if (!status_or_code.ok()) {
std::clog << status_or_code.status() << std::endl;
std::cerr << status_or_code.status() << std::endl;
return EXIT_FAILURE;
}
return status_or_code.value();
Expand Down
2 changes: 1 addition & 1 deletion elisp/emacs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static absl::StatusOr<int> RunEmacsImpl(const NativeString& argv0,
int RunEmacs(const NativeString& argv0, const std::vector<NativeString>& args) {
const absl::StatusOr<int> status_or_code = RunEmacsImpl(argv0, args);
if (!status_or_code.ok()) {
std::clog << status_or_code.status() << std::endl;
std::cerr << status_or_code.status() << std::endl;
return EXIT_FAILURE;
}
return status_or_code.value();
Expand Down
16 changes: 8 additions & 8 deletions elisp/process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static std::wstring BuildEnvironmentBlock(
std::wstring result;
for (const std::wstring& var : vars) {
if (var.find(L'\0') != var.npos) {
std::wclog << L"Environment variable " << var
std::wcerr << L"Environment variable " << var
<< L" contains a null character" << std::endl;
std::abort();
}
Expand All @@ -142,11 +142,11 @@ static std::wstring BuildEnvironmentBlock(
}
static wchar_t* Pointer(std::wstring& string) {
if (string.empty()) {
std::wclog << L"empty string" << std::endl;
std::wcerr << L"empty string" << std::endl;
std::abort();
}
if (string.find('\0') != string.npos) {
std::wclog << string << L" contains null character" << std::endl;
std::wcerr << string << L" contains null character" << std::endl;
std::abort();
}
return &string.front();
Expand All @@ -156,11 +156,11 @@ static std::vector<char*> Pointers(std::vector<std::string>& strings) {
std::vector<char*> ptrs;
for (std::string& s : strings) {
if (s.empty()) {
std::clog << "empty string" << std::endl;
std::cerr << "empty string" << std::endl;
std::abort();
}
if (s.find('\0') != s.npos) {
std::clog << s << " contains null character" << std::endl;
std::cerr << s << " contains null character" << std::endl;
std::abort();
}
ptrs.push_back(&s.front());
Expand All @@ -179,7 +179,7 @@ static Environment CopyEnv() {
const std::unique_ptr<wchar_t, Free> envp(::GetEnvironmentStringsW());
if (envp == nullptr) {
// This cannot really happen in practice.
std::wclog << L"GetEnvironmentStringsW failed" << std::endl;
std::wcerr << L"GetEnvironmentStringsW failed" << std::endl;
std::abort();
}
const wchar_t* p = envp.get();
Expand All @@ -190,15 +190,15 @@ static Environment CopyEnv() {
// Their names start with an equals sign.
const wchar_t* const q = std::wcschr(p + 1, L'=');
if (q == nullptr) {
std::wclog << "Invalid environment block entry " << p << std::endl;
std::wcerr << "Invalid environment block entry " << p << std::endl;
std::abort();
}
map.emplace(std::wstring(p, q), std::wstring(q + 1));
p = std::wcschr(p, L'\0');
if (p == nullptr) {
// This can’t happen because the environment block is terminated by a
// double null character.
std::wclog
std::wcerr
<< L"GetEnvironmentStringsW returned an invalid environment block"
<< std::endl;
std::abort();
Expand Down
2 changes: 1 addition & 1 deletion elisp/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static absl::StatusOr<int> RunTestImpl(const std::vector<NativeString>& args) {
int RunTest(const std::vector<NativeString>& args) {
const absl::StatusOr<int> status_or_code = RunTestImpl(args);
if (!status_or_code.ok()) {
std::clog << status_or_code.status() << std::endl;
std::cerr << status_or_code.status() << std::endl;
return EXIT_FAILURE;
}
return status_or_code.value();
Expand Down

0 comments on commit 780d8d8

Please sign in to comment.