1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-10-23 21:28:56 +03:00

Use the matching END macro to close MEM_CONTEXT_OBJ/PRIOR blocks.

MEM_CONTEXT_PRIOR_END() and MEM_CONTEXT_OBJ_END() are both defined as MEM_CONTEXT_END(), so closing a MEM_CONTEXT_PRIOR_BEGIN() or MEM_CONTEXT_OBJ_BEGIN() block with the base MEM_CONTEXT_END() expands identically and cannot be detected by the compiler. Eight sites had drifted to the base closer: four in info.c, one in io/session.c, and one each in the s3, azure, and gcs storage drivers.

The headers document the matching END as the intended pairing, so use it. Preprocessed output was verified byte-identical before and after, so the change is a no-op.

These were found while prototyping a lint check for block-macro pairing.
This commit is contained in:
David Steele
2026-07-20 17:17:26 +07:00
parent edf913761f
commit 42699b1fff
5 changed files with 8 additions and 8 deletions

View File

@@ -89,7 +89,7 @@ ioSessionPeerNameSet(IoSession *const this, const String *const peerName)
{
this->pub.peerName = strDup(peerName); // {vm_covered}
}
MEM_CONTEXT_END(); // {vm_covered}
MEM_CONTEXT_OBJ_END(); // {vm_covered}
FUNCTION_TEST_RETURN_VOID(); // {vm_covered}
} // {vm_covered}

View File

@@ -193,7 +193,7 @@ infoNewLoad(IoRead *const read, InfoLoadNewCallback *const callbackFunction, voi
{
this->pub.backrestVersion = varStr(jsonToVar(value->value));
}
MEM_CONTEXT_END();
MEM_CONTEXT_OBJ_END();
}
// Store checksum to be validated later
else if (strEqZ(value->key, INFO_KEY_CHECKSUM))
@@ -202,7 +202,7 @@ infoNewLoad(IoRead *const read, InfoLoadNewCallback *const callbackFunction, voi
{
checksumExpected = varStr(jsonToVar(value->value));
}
MEM_CONTEXT_END();
MEM_CONTEXT_OBJ_END();
}
}
// Process cipher section
@@ -215,7 +215,7 @@ infoNewLoad(IoRead *const read, InfoLoadNewCallback *const callbackFunction, voi
{
this->pub.cipherPass = varStr(jsonToVar(value->value));
}
MEM_CONTEXT_END();
MEM_CONTEXT_OBJ_END();
}
}
// Else pass to callback for processing
@@ -410,7 +410,7 @@ infoCipherPassSet(Info *const this, const String *const cipherPass)
{
this->pub.cipherPass = strDup(cipherPass);
}
MEM_CONTEXT_END();
MEM_CONTEXT_OBJ_END();
FUNCTION_TEST_RETURN_VOID();
}

View File

@@ -381,7 +381,7 @@ storageAzureRequestAsync(StorageAzure *const this, const String *const verb, Sto
result = httpRequestNewP(
this->httpClient, verb, path, .query = query, .header = requestHeader, .content = content);
}
MEM_CONTEXT_END();
MEM_CONTEXT_PRIOR_END();
}
MEM_CONTEXT_TEMP_END();

View File

@@ -516,7 +516,7 @@ storageGcsRequestAsync(StorageGcs *const this, const String *const verb, Storage
result = httpRequestNewP(
this->httpClient, verb, path, .query = query, .header = requestHeader, .content = content);
}
MEM_CONTEXT_END();
MEM_CONTEXT_PRIOR_END();
}
MEM_CONTEXT_TEMP_END();

View File

@@ -676,7 +676,7 @@ storageS3RequestAsync(StorageS3 *const this, const String *const verb, const Str
result = httpRequestNewP(
this->httpClient, verb, path, .query = param.query, .header = requestHeader, .content = param.content);
}
MEM_CONTEXT_END();
MEM_CONTEXT_PRIOR_END();
}
MEM_CONTEXT_TEMP_END();