diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-02-06 11:46:26 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-06 11:46:26 +0100 |
commit | f017b749ea9f1586d2308504553d40bf4cc5439d (patch) | |
tree | c6033924a0de9be1ab140596e305898c651bf57e /security/nss/gtests/common/scoped_ptrs.h | |
parent | 7c728b3c7680662fc4e92b5d03697b8339560b08 (diff) | |
download | uxp-f017b749ea9f1586d2308504553d40bf4cc5439d.tar.gz |
Update NSS to 3.32.1-RTM
Diffstat (limited to 'security/nss/gtests/common/scoped_ptrs.h')
-rw-r--r-- | security/nss/gtests/common/scoped_ptrs.h | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/security/nss/gtests/common/scoped_ptrs.h b/security/nss/gtests/common/scoped_ptrs.h deleted file mode 100644 index 2a96ee94a0..0000000000 --- a/security/nss/gtests/common/scoped_ptrs.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef scoped_ptrs_h__ -#define scoped_ptrs_h__ - -#include <memory> -#include "cert.h" -#include "keyhi.h" -#include "pk11pub.h" - -namespace nss_test { - -struct ScopedDelete { - void operator()(CERTCertificate* cert) { CERT_DestroyCertificate(cert); } - void operator()(CERTCertificateList* list) { - CERT_DestroyCertificateList(list); - } - void operator()(CERTCertList* list) { CERT_DestroyCertList(list); } - void operator()(CERTSubjectPublicKeyInfo* spki) { - SECKEY_DestroySubjectPublicKeyInfo(spki); - } - void operator()(PK11SlotInfo* slot) { PK11_FreeSlot(slot); } - void operator()(PK11SymKey* key) { PK11_FreeSymKey(key); } - void operator()(SECAlgorithmID* id) { SECOID_DestroyAlgorithmID(id, true); } - void operator()(SECItem* item) { SECITEM_FreeItem(item, true); } - void operator()(SECKEYPublicKey* key) { SECKEY_DestroyPublicKey(key); } - void operator()(SECKEYPrivateKey* key) { SECKEY_DestroyPrivateKey(key); } -}; - -template <class T> -struct ScopedMaybeDelete { - void operator()(T* ptr) { - if (ptr) { - ScopedDelete del; - del(ptr); - } - } -}; - -#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDelete<x> > Scoped##x - -SCOPED(CERTCertificate); -SCOPED(CERTCertificateList); -SCOPED(CERTCertList); -SCOPED(CERTSubjectPublicKeyInfo); -SCOPED(PK11SlotInfo); -SCOPED(PK11SymKey); -SCOPED(SECAlgorithmID); -SCOPED(SECItem); -SCOPED(SECKEYPublicKey); -SCOPED(SECKEYPrivateKey); - -#undef SCOPED - -} // namespace nss_test - -#endif |