Skip to content

da_move could lead to undesired side effects #74

Description

@drocha87

ded/src/common.h

Lines 37 to 43 in 57d23fa

#define da_move(dst, src) \
do { \
free((dst)->items); \
(dst)->items = (src).items; \
(dst)->count = (src).count; \
(dst)->capacity = (src).capacity; \
} while (0)

I think that we should "clear" src after moving it to dst (setting (src).items = NULL; and zeroing its count and capacity).

Since src still holds a pointer to items it could cause undesired side effects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions