mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 16:37:19 +09:00
24 lines
720 B
C
24 lines
720 B
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
|
|
#include "memory-util.h"
|
|
#include "static-destruct.h"
|
|
|
|
void static_destruct_impl(const StaticDestructor *start, const StaticDestructor *end) {
|
|
if (!start)
|
|
return;
|
|
|
|
for (const StaticDestructor *d = ALIGN_PTR(start); d < end; d = ALIGN_PTR(d + 1))
|
|
switch (d->type) {
|
|
case STATIC_DESTRUCTOR_SIMPLE:
|
|
d->simple.destroy(d->simple.data);
|
|
break;
|
|
|
|
case STATIC_DESTRUCTOR_ARRAY:
|
|
array_cleanup(&d->array);
|
|
break;
|
|
|
|
default:
|
|
assert_not_reached();
|
|
}
|
|
}
|