1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-30 05:39:12 +02:00

Remove THIS_MEM_CONTEXT() macro.

objMemContext(this) performs the same task and is easier to read.

Most instances of this macro were removed by 6e7be3c0.
This commit is contained in:
David Steele 2022-04-25 09:24:00 -04:00
parent 6e7be3c052
commit 699f15dd2b
4 changed files with 6 additions and 12 deletions

View File

@ -52,12 +52,6 @@ Create a local "this" variable of the correct type from a THIS_VOID parameter
***********************************************************************************************************************************/
#define THIS(type) type *this = thisVoid
/***********************************************************************************************************************************
Get the mem context of this object
***********************************************************************************************************************************/
#define THIS_MEM_CONTEXT() \
memContextFromAllocExtra(this)
/***********************************************************************************************************************************
Cast this private struct, e.g. List, to the associated public struct, e.g. ListPub. Note that the public struct must be the first
member of the private struct. For example:

View File

@ -89,7 +89,7 @@ storageReadPosixOpen(THIS_VOID)
else
{
// Set free callback to ensure the file descriptor is freed
memContextCallbackSet(THIS_MEM_CONTEXT(), storageReadPosixFreeResource, this);
memContextCallbackSet(objMemContext(this), storageReadPosixFreeResource, this);
// Seek to offset
if (this->interface.offset != 0)
@ -165,7 +165,7 @@ storageReadPosixClose(THIS_VOID)
ASSERT(this != NULL);
memContextCallbackClear(THIS_MEM_CONTEXT());
memContextCallbackClear(objMemContext(this));
storageReadPosixFreeResource(this);
this->fd = -1;

View File

@ -103,7 +103,7 @@ storageWritePosixOpen(THIS_VOID)
}
// Set free callback to ensure the file descriptor is freed
memContextCallbackSet(THIS_MEM_CONTEXT(), storageWritePosixFreeResource, this);
memContextCallbackSet(objMemContext(this), storageWritePosixFreeResource, this);
// Update user/group owner
if (this->interface.user != NULL || this->interface.group != NULL)
@ -172,7 +172,7 @@ storageWritePosixClose(THIS_VOID)
THROW_ON_SYS_ERROR_FMT(fsync(this->fd) == -1, FileSyncError, STORAGE_ERROR_WRITE_SYNC, strZ(this->nameTmp));
// Close the file
memContextCallbackClear(THIS_MEM_CONTEXT());
memContextCallbackClear(objMemContext(this));
THROW_ON_SYS_ERROR_FMT(close(this->fd) == -1, FileCloseError, STORAGE_ERROR_WRITE_CLOSE, strZ(this->nameTmp));
this->fd = -1;

View File

@ -107,7 +107,7 @@ storageWriteRemoteOpen(THIS_VOID)
}
// Set free callback to ensure remote file is freed
memContextCallbackSet(THIS_MEM_CONTEXT(), storageWriteRemoteFreeResource, this);
memContextCallbackSet(objMemContext(this), storageWriteRemoteFreeResource, this);
}
MEM_CONTEXT_TEMP_END();
@ -171,7 +171,7 @@ storageWriteRemoteClose(THIS_VOID)
MEM_CONTEXT_TEMP_END();
this->client = NULL;
memContextCallbackClear(THIS_MEM_CONTEXT());
memContextCallbackClear(objMemContext(this));
}
FUNCTION_LOG_RETURN_VOID();