mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Remove mostly useless mem context in storageRemoteInfoProtocolPut().
Maybe this once had a deeper purpose but now at least it is just used to avoid a few trivial allocations. If we really wanted to do that a flag would be better but it does not seem worth the trouble.
This commit is contained in:
parent
6ec2241e15
commit
890b9d0093
@ -172,7 +172,6 @@ storageRemoteFeatureProtocol(PackRead *const param, ProtocolServer *const server
|
||||
/**********************************************************************************************************************************/
|
||||
typedef struct StorageRemoteInfoProcotolWriteData
|
||||
{
|
||||
MemContext *memContext; // Mem context used to store values from last call
|
||||
time_t timeModifiedLast; // timeModified from last call
|
||||
mode_t modeLast; // mode from last call
|
||||
uid_t userIdLast; // userId from last call
|
||||
@ -240,36 +239,22 @@ storageRemoteInfoProtocolPut(
|
||||
pckWriteStrP(write, info->linkDestination);
|
||||
}
|
||||
|
||||
// Store defaults to use for the next call. If memContext is NULL this function is only being called one time so there is no
|
||||
// point in storing defaults.
|
||||
if (data->memContext != NULL)
|
||||
// Store defaults to use for the next call
|
||||
data->timeModifiedLast = info->timeModified;
|
||||
data->modeLast = info->mode;
|
||||
data->userIdLast = info->userId;
|
||||
data->groupIdLast = info->groupId;
|
||||
|
||||
if (info->user != NULL && !strEq(info->user, data->user)) // {vm_covered}
|
||||
{
|
||||
data->timeModifiedLast = info->timeModified;
|
||||
data->modeLast = info->mode;
|
||||
data->userIdLast = info->userId;
|
||||
data->groupIdLast = info->groupId;
|
||||
strFree(data->user);
|
||||
data->user = strDup(info->user);
|
||||
}
|
||||
|
||||
if (info->user != NULL && !strEq(info->user, data->user)) // {vm_covered}
|
||||
{
|
||||
strFree(data->user);
|
||||
|
||||
MEM_CONTEXT_BEGIN(data->memContext)
|
||||
{
|
||||
data->user = strDup(info->user);
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
}
|
||||
|
||||
if (info->group != NULL && !strEq(info->group, data->group)) // {vm_covered}
|
||||
{
|
||||
strFree(data->group);
|
||||
|
||||
MEM_CONTEXT_BEGIN(data->memContext)
|
||||
{
|
||||
data->group = strDup(info->group);
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
}
|
||||
if (info->group != NULL && !strEq(info->group, data->group)) // {vm_covered}
|
||||
{
|
||||
strFree(data->group);
|
||||
data->group = strDup(info->group);
|
||||
}
|
||||
|
||||
FUNCTION_TEST_RETURN_VOID();
|
||||
@ -355,7 +340,7 @@ storageRemoteListProtocol(PackRead *const param, ProtocolServer *const server)
|
||||
{
|
||||
const String *const path = pckReadStrP(param);
|
||||
const StorageInfoLevel level = (StorageInfoLevel)pckReadU32P(param);
|
||||
StorageRemoteInfoProtocolWriteData writeData = {.memContext = memContextCurrent()};
|
||||
StorageRemoteInfoProtocolWriteData writeData = {0};
|
||||
StorageList *const list = storageInterfaceListP(storageRemoteProtocolLocal.driver, path, level);
|
||||
|
||||
// Put list
|
||||
|
Loading…
x
Reference in New Issue
Block a user