Skip to content

Commit fdbf506

Browse files
authored
Refactor Postgres message creation to use make_unique (#2169)
1 parent 3bb035d commit fdbf506

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Packet++/src/PostgresLayer.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ namespace pcpp
414414
}
415415
case PostgresBackendMessage_S:
416416
{
417-
return std::unique_ptr<PostgresMessage>(new PostgresParameterStatus(data, messageLength + 1));
417+
return std::make_unique<PostgresParameterStatus>(data, messageLength + 1);
418418
}
419419
case PostgresBackendMessage_Z:
420420
{
@@ -453,7 +453,7 @@ namespace pcpp
453453
}
454454
case PostgresBackendMessage_D:
455455
{
456-
return std::unique_ptr<PostgresMessage>(new PostgresDataRowMessage(data, messageLength + 1));
456+
return std::make_unique<PostgresDataRowMessage>(data, messageLength + 1);
457457
}
458458
case PostgresBackendMessage_I:
459459
{
@@ -462,7 +462,7 @@ namespace pcpp
462462
}
463463
case PostgresBackendMessage_E:
464464
{
465-
return std::unique_ptr<PostgresMessage>(new PostgresErrorResponseMessage(data, messageLength + 1));
465+
return std::make_unique<PostgresErrorResponseMessage>(data, messageLength + 1);
466466
}
467467
case PostgresBackendMessage_V:
468468
{
@@ -506,7 +506,7 @@ namespace pcpp
506506
}
507507
case PostgresBackendMessage_T:
508508
{
509-
return std::unique_ptr<PostgresMessage>(new PostgresRowDescriptionMessage(data, messageLength + 1));
509+
return std::make_unique<PostgresRowDescriptionMessage>(data, messageLength + 1);
510510
}
511511
default:
512512
{
@@ -547,7 +547,7 @@ namespace pcpp
547547
{
548548
case PostgresFrontendTag_StartupMessage:
549549
{
550-
return std::unique_ptr<PostgresMessage>(new PostgresStartupMessage(data, messageLength));
550+
return std::make_unique<PostgresStartupMessage>(data, messageLength);
551551
}
552552
case PostgresFrontendTag_SSLRequest:
553553
{
@@ -591,8 +591,8 @@ namespace pcpp
591591
{
592592
case PostgresFrontendMessage_Q:
593593
{
594-
return std::unique_ptr<PostgresMessage>(
595-
new PostgresQueryMessage(data, (std::min)(static_cast<size_t>(messageLength) + 1, dataLen)));
594+
return std::make_unique<PostgresQueryMessage>(data,
595+
(std::min)(static_cast<size_t>(messageLength) + 1, dataLen));
596596
}
597597
case PostgresFrontendMessage_P:
598598
{

0 commit comments

Comments
 (0)