summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-01 12:42:31 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-04 14:16:39 +0100
commit311b63fef8ee54cbf1539894e6f0d44761737b18 (patch)
treee8b46a7793caedb71b5c89762a38ed41ce02e06c
parentf23ab4dc3ca9a97470ca46775a6cd406a82de6d5 (diff)
downloadsystemd-311b63fef8ee54cbf1539894e6f0d44761737b18.tar.gz
Remove now-unused refcnt.h
-rw-r--r--src/basic/meson.build1
-rw-r--r--src/basic/refcnt.h54
-rw-r--r--src/libsystemd/sd-device/device-private.c1
3 files changed, 0 insertions, 56 deletions
diff --git a/src/basic/meson.build b/src/basic/meson.build
index e5852f32f9..c62e4a3b59 100644
--- a/src/basic/meson.build
+++ b/src/basic/meson.build
@@ -148,7 +148,6 @@ basic_sources = files('''
ratelimit.h
raw-clone.h
raw-reboot.h
- refcnt.h
replace-var.c
replace-var.h
rlimit-util.c
diff --git a/src/basic/refcnt.h b/src/basic/refcnt.h
deleted file mode 100644
index 40f9a84a22..0000000000
--- a/src/basic/refcnt.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1+ */
-#pragma once
-
-/* A type-safe atomic refcounter.
- *
- * DO NOT USE THIS UNLESS YOU ACTUALLY CARE ABOUT THREAD SAFETY! */
-
-typedef struct {
- volatile unsigned _value;
-} RefCount;
-
-#define REFCNT_GET(r) ((r)._value)
-#define REFCNT_INC(r) (__sync_add_and_fetch(&(r)._value, 1))
-#define REFCNT_DEC(r) (__sync_sub_and_fetch(&(r)._value, 1))
-
-#define REFCNT_INIT ((RefCount) { ._value = 1 })
-
-#define _DEFINE_ATOMIC_REF_FUNC(type, name, scope) \
- scope type *name##_ref(type *p) { \
- if (!p) \
- return NULL; \
- \
- assert_se(REFCNT_INC(p->n_ref) >= 2); \
- return p; \
- }
-
-#define _DEFINE_ATOMIC_UNREF_FUNC(type, name, free_func, scope) \
- scope type *name##_unref(type *p) { \
- if (!p) \
- return NULL; \
- \
- if (REFCNT_DEC(p->n_ref) > 0) \
- return NULL; \
- \
- return free_func(p); \
- }
-
-#define DEFINE_ATOMIC_REF_FUNC(type, name) \
- _DEFINE_ATOMIC_REF_FUNC(type, name,)
-#define DEFINE_PUBLIC_ATOMIC_REF_FUNC(type, name) \
- _DEFINE_ATOMIC_REF_FUNC(type, name, _public_)
-
-#define DEFINE_ATOMIC_UNREF_FUNC(type, name, free_func) \
- _DEFINE_ATOMIC_UNREF_FUNC(type, name, free_func,)
-#define DEFINE_PUBLIC_ATOMIC_UNREF_FUNC(type, name, free_func) \
- _DEFINE_ATOMIC_UNREF_FUNC(type, name, free_func, _public_)
-
-#define DEFINE_ATOMIC_REF_UNREF_FUNC(type, name, free_func) \
- DEFINE_ATOMIC_REF_FUNC(type, name); \
- DEFINE_ATOMIC_UNREF_FUNC(type, name, free_func);
-
-#define DEFINE_PUBLIC_ATOMIC_REF_UNREF_FUNC(type, name, free_func) \
- DEFINE_PUBLIC_ATOMIC_REF_FUNC(type, name); \
- DEFINE_PUBLIC_ATOMIC_UNREF_FUNC(type, name, free_func);
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c
index 76267a1e74..0d0bdca800 100644
--- a/src/libsystemd/sd-device/device-private.c
+++ b/src/libsystemd/sd-device/device-private.c
@@ -18,7 +18,6 @@
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
-#include "refcnt.h"
#include "set.h"
#include "string-table.h"
#include "string-util.h"