summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-hwdb/sd-hwdb.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-01 18:04:58 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-04 14:16:39 +0100
commit468905cac890ad11ad8300ddc5073537ceca3607 (patch)
tree6f9d908654f0400078bda6b82a5cd2f05729969f /src/libsystemd/sd-hwdb/sd-hwdb.c
parentbus: make reference counting non-atomic (diff)
downloadsystemd-468905cac890ad11ad8300ddc5073537ceca3607.tar.xz
systemd-468905cac890ad11ad8300ddc5073537ceca3607.zip
sd-hwdb: use non-atomic reference counters
The sd-hwdb objects cannot be used concurrently from two threads in any meaningful way, because query and iteration operations modify the object. Thus atomic reference counts are pointless.
Diffstat (limited to 'src/libsystemd/sd-hwdb/sd-hwdb.c')
-rw-r--r--src/libsystemd/sd-hwdb/sd-hwdb.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c
index 233944c078..2e68a1a2fd 100644
--- a/src/libsystemd/sd-hwdb/sd-hwdb.c
+++ b/src/libsystemd/sd-hwdb/sd-hwdb.c
@@ -18,12 +18,11 @@
#include "hashmap.h"
#include "hwdb-internal.h"
#include "hwdb-util.h"
-#include "refcnt.h"
#include "string-util.h"
#include "util.h"
struct sd_hwdb {
- RefCount n_ref;
+ unsigned n_ref;
FILE *f;
struct stat st;
@@ -316,7 +315,7 @@ _public_ int sd_hwdb_new(sd_hwdb **ret) {
if (!hwdb)
return -ENOMEM;
- hwdb->n_ref = REFCNT_INIT;
+ hwdb->n_ref = 1;
/* find hwdb.bin in hwdb_bin_paths */
NULSTR_FOREACH(hwdb_bin_path, hwdb_bin_paths) {
@@ -370,7 +369,7 @@ static sd_hwdb *hwdb_free(sd_hwdb *hwdb) {
return mfree(hwdb);
}
-DEFINE_PUBLIC_ATOMIC_REF_UNREF_FUNC(sd_hwdb, sd_hwdb, hwdb_free)
+DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC(sd_hwdb, sd_hwdb, hwdb_free)
bool hwdb_validate(sd_hwdb *hwdb) {
bool found = false;