Merge pull request #802 from wzl12356/master

kafka: fix operator=
This commit is contained in:
xiehan
2022-03-15 18:40:53 +08:00
committed by GitHub
+54 -33
View File
@@ -107,11 +107,14 @@ public:
KafkaList& operator= (const KafkaList& copy)
{
this->~KafkaList();
this->ref = copy.ref;
++*this->ref;
this->t_list = copy.t_list;
this->curpos = copy.curpos;
if (this != &copy)
{
this->~KafkaList();
this->ref = copy.ref;
++*this->ref;
this->t_list = copy.t_list;
this->curpos = copy.curpos;
}
return *this;
}
@@ -227,10 +230,13 @@ public:
KafkaMap& operator= (const KafkaMap& copy)
{
this->~KafkaMap();
this->ref = copy.ref;
++*this->ref;
this->t_map = copy.t_map;
if (this != &copy)
{
this->~KafkaMap();
this->ref = copy.ref;
++*this->ref;
this->t_map = copy.t_map;
}
return *this;
}
@@ -621,10 +627,13 @@ public:
KafkaConfig& operator= (const KafkaConfig& copy)
{
this->~KafkaConfig();
this->ptr = copy.ptr;
this->ref = copy.ref;
++*this->ref;
if (this != &copy)
{
this->~KafkaConfig();
this->ptr = copy.ptr;
this->ref = copy.ref;
++*this->ref;
}
return *this;
}
@@ -724,10 +733,13 @@ public:
KafkaRecord& operator= (KafkaRecord& copy)
{
this->~KafkaRecord();
this->ptr = copy.ptr;
this->ref = copy.ref;
++*this->ref;
if (this != &copy)
{
this->~KafkaRecord();
this->ptr = copy.ptr;
this->ref = copy.ref;
++*this->ref;
}
return *this;
}
@@ -851,13 +863,16 @@ public:
KafkaToppar& operator= (KafkaToppar& copy)
{
this->~KafkaToppar();
this->ptr = copy.ptr;
this->ref = copy.ref;
++*this->ref;
this->curpos = copy.curpos;
this->startpos = copy.startpos;
this->endpos = copy.endpos;
if (this != &copy)
{
this->~KafkaToppar();
this->ptr = copy.ptr;
this->ref = copy.ref;
++*this->ref;
this->curpos = copy.curpos;
this->startpos = copy.startpos;
this->endpos = copy.endpos;
}
return *this;
}
@@ -1039,11 +1054,14 @@ public:
KafkaBroker& operator= (const KafkaBroker& copy)
{
this->~KafkaBroker();
this->ptr = copy.ptr;
this->ref = copy.ref;
if (this->ref)
++*this->ref;
if (this != &copy)
{
this->~KafkaBroker();
this->ptr = copy.ptr;
this->ref = copy.ref;
if (this->ref)
++*this->ref;
}
return *this;
}
@@ -1200,10 +1218,13 @@ public:
KafkaMeta& operator= (KafkaMeta& copy)
{
this->~KafkaMeta();
this->ptr = copy.ptr;
this->ref = copy.ref;
++*this->ref;
if (this != &copy)
{
this->~KafkaMeta();
this->ptr = copy.ptr;
this->ref = copy.ref;
++*this->ref;
}
return *this;
}