#include "config.h" #include #include #include #include #include #include #include "logerr.h" #include "util.h" #include "set.h" struct Set { size_t count; }; int set_new(const struct Set **const out) { int rc = -1; const struct Set *ret = NULL; ret = malloc(sizeof(*ret)); if (ret == NULL) { logerr("malloc(): %s", strerror(errno)); goto out; } memcpy((void *)ret, &(struct Set) { .count = 0U, }, sizeof(*ret)); *out = ret; rc = 0; out: if (rc) { if (ret != NULL) { freeit((void *)&ret); } } return rc; } void set_free(const struct Set **const s) { assert((*s) != NULL); free((void *)*s); }