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: do not use pointers to std::vector · nodejs/node@bbfd2e3

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_crypto.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const char* const root_certs[] = {
127127
std::string extra_root_certs_file; // NOLINT(runtime/string)
128128

129129
X509_STORE* root_cert_store;
130-
std::vector<X509*>* root_certs_vector;
130+
std::vector<X509*> root_certs_vector;
131131

132132
// Just to generate static methods
133133
template class SSLWrap<TLSWrap>;
@@ -694,9 +694,7 @@ static int X509_up_ref(X509* cert) {
694694

695695

696696
static X509_STORE* NewRootCertStore() {
697-
if (!root_certs_vector) {
698-
root_certs_vector = new std::vector<X509*>;
699-
697+
if (root_certs_vector.empty()) {
700698
for (size_t i = 0; i < arraysize(root_certs); i++) {
701699
BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i]));
702700
X509 *x509 = PEM_read_bio_X509(bp, nullptr, CryptoPemCallback, nullptr);
@@ -705,12 +703,12 @@ static X509_STORE* NewRootCertStore() {
705703
// Parse errors from the built-in roots are fatal.
706704
CHECK_NE(x509, nullptr);
707705

708-
root_certs_vector->push_back(x509);
706+
root_certs_vector.push_back(x509);
709707
}
710708
}
711709

712710
X509_STORE* store = X509_STORE_new();
713-
for (auto& cert : *root_certs_vector) {
711+
for (X509 *cert : root_certs_vector) {
714712
X509_up_ref(cert);
715713
X509_STORE_add_cert(store, cert);
716714
}

0 commit comments

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