Change link() to shallowCopy() (issue #1343)

Instead of storing a pointer, the function copies the `VariantData`.

Benefits:
* smaller code
* no impact on programs that don't use this feature

Drawbacks:
* changes to the original variant are not always reflected on the copy
* modifying the original from the shallow copy leads to UB
This commit is contained in:
Benoit Blanchon
2022-07-05 17:07:43 +02:00
parent 3b3ab8c4e1
commit cd8373ad32
36 changed files with 78 additions and 543 deletions

View File

@@ -31,8 +31,6 @@ enum {
VALUE_IS_SIGNED_INTEGER = 0x0A,
VALUE_IS_FLOAT = 0x0C,
VALUE_IS_POINTER = 0x10,
COLLECTION_MASK = 0x60,
VALUE_IS_OBJECT = 0x20,
VALUE_IS_ARRAY = 0x40,
@@ -51,7 +49,6 @@ union VariantContent {
UInt asUnsignedInteger;
Integer asSignedInteger;
CollectionData asCollection;
const class VariantData *asPointer;
struct {
const char *data;
size_t size;