mirror of
https://github.com/corda/corda.git
synced 2025-06-22 17:09:00 +00:00
replace calls to ExceptionOccurred with calls to ExceptionCheck
The latter is cheaper (avoids a state transition and possible memory allocation) when we just want to know if an exception is thrown without needing a handle to that exception.
This commit is contained in:
@ -170,7 +170,7 @@ map(JNIEnv* e, const char* path)
|
||||
void* data = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0);
|
||||
if (data) {
|
||||
void* p = allocate(e, sizeof(Mapping));
|
||||
if (not e->ExceptionOccurred()) {
|
||||
if (not e->ExceptionCheck()) {
|
||||
result = new (p)
|
||||
Mapping(static_cast<uint8_t*>(data), size, file, mapping);
|
||||
}
|
||||
@ -186,7 +186,7 @@ map(JNIEnv* e, const char* path)
|
||||
CloseHandle(file);
|
||||
}
|
||||
}
|
||||
if (result == 0 and not e->ExceptionOccurred()) {
|
||||
if (result == 0 and not e->ExceptionCheck()) {
|
||||
throwNew(e, "java/io/IOException", "%d", GetLastError());
|
||||
}
|
||||
return result;
|
||||
@ -256,14 +256,14 @@ map(JNIEnv* e, const char* path)
|
||||
void* data = mmap(0, s.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (data) {
|
||||
void* p = allocate(e, sizeof(Mapping));
|
||||
if (not e->ExceptionOccurred()) {
|
||||
if (not e->ExceptionCheck()) {
|
||||
result = new (p) Mapping(static_cast<uint8_t*>(data), s.st_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
if (result == 0 and not e->ExceptionOccurred()) {
|
||||
if (result == 0 and not e->ExceptionCheck()) {
|
||||
throwNewErrno(e, "java/io/IOException");
|
||||
}
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user