forked from mirrors/gecko-dev
Bug 1873131 - Add some assertions to UniqueFileHandle. r=nika,tsmith
Differential Revision: https://phabricator.services.mozilla.com/D197748
This commit is contained in:
parent
39cc886eed
commit
7cb8ed130b
1 changed files with 6 additions and 1 deletions
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/fallible.h"
|
||||
|
|
@ -103,7 +104,11 @@ typedef int FileHandleType;
|
|||
#endif
|
||||
|
||||
struct FileHandleHelper {
|
||||
MOZ_IMPLICIT FileHandleHelper(FileHandleType aHandle) : mHandle(aHandle) {}
|
||||
MOZ_IMPLICIT FileHandleHelper(FileHandleType aHandle) : mHandle(aHandle) {
|
||||
#if defined(XP_UNIX) && (defined(DEBUG) || defined(FUZZING))
|
||||
MOZ_RELEASE_ASSERT(aHandle == kInvalidHandle || aHandle > 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
MOZ_IMPLICIT constexpr FileHandleHelper(std::nullptr_t)
|
||||
: mHandle(kInvalidHandle) {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue