aqhome: added AQH_Message_dup()

This commit is contained in:
Martin Preuss
2025-03-11 23:00:41 +01:00
parent edb6c90f46
commit 44c5eb65bd
2 changed files with 19 additions and 0 deletions

View File

@@ -51,6 +51,24 @@ AQH_MESSAGE *AQH_Message_new(void)
AQH_MESSAGE *AQH_Message_dup(const AQH_MESSAGE *origMsg)
{
if (origMsg) {
AQH_MESSAGE *msg;
msg=AQH_Message_new();
if (origMsg->msgPointer && origMsg->msgSize) {
AQH_Message_SetData(msg, origMsg->msgPointer, origMsg->msgSize);
msg->usedSize=origMsg->usedSize;
}
return msg;
}
else
return NULL;
}
void AQH_Message_IncRef(AQH_MESSAGE *msg)
{
if (msg && msg->refCount)

View File

@@ -25,6 +25,7 @@ GWEN_INHERIT_FUNCTION_LIB_DEFS(AQH_MESSAGE, AQHOME_API)
AQHOME_API AQH_MESSAGE *AQH_Message_new(void);
AQHOME_API AQH_MESSAGE *AQH_Message_dup(const AQH_MESSAGE *origMsg);
AQHOME_API void AQH_Message_IncRef(AQH_MESSAGE *msg);
AQHOME_API void AQH_Message_free(AQH_MESSAGE *msg);