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 — crypto: skip clearing empty OpenSSL error queues · Renegade334/node@3b93ac1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • deps/ncrypto
    • ncrypto.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎deps/ncrypto/ncrypto.cc‎

Copy file name to clipboardExpand all lines: deps/ncrypto/ncrypto.cc
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,22 @@ constexpr BoringSSLCipher kBoringSSLCiphers[] = {
340340

341341
// ============================================================================
342342

343+
namespace {
344+
// ERR_clear_error() resets every slot of the error queue even when it is
345+
// empty, which costs several times more than checking for an error first.
346+
void ClearErrorQueue() {
347+
if (ERR_peek_error() != 0) ERR_clear_error();
348+
}
349+
} // namespace
350+
343351
ClearErrorOnReturn::ClearErrorOnReturn(CryptoErrorList* errors)
344352
: errors_(errors) {
345-
ERR_clear_error();
353+
ClearErrorQueue();
346354
}
347355

348356
ClearErrorOnReturn::~ClearErrorOnReturn() {
349357
if (errors_ != nullptr) errors_->capture();
350-
ERR_clear_error();
358+
ClearErrorQueue();
351359
}
352360

353361
unsigned long ClearErrorOnReturn::peekError() { // NOLINT(runtime/int)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — 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.