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.
@@ -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,10 +239,7 @@ 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;
@@ -252,25 +248,14 @@ storageRemoteInfoProtocolPut(
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();
- }
- }
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
