diff options
-rw-r--r-- | src/basic/hash-funcs.h | 2 | ||||
-rw-r--r-- | src/core/job.c | 10 | ||||
-rw-r--r-- | src/core/job.h | 2 | ||||
-rw-r--r-- | src/core/transaction.c | 14 |
4 files changed, 15 insertions, 13 deletions
diff --git a/src/basic/hash-funcs.h b/src/basic/hash-funcs.h index c14302ec72..be64289252 100644 --- a/src/basic/hash-funcs.h +++ b/src/basic/hash-funcs.h @@ -102,7 +102,7 @@ extern const struct hash_ops uint64_hash_ops; /* On some archs dev_t is 32bit, and on others 64bit. And sometimes it's 64bit on 32bit archs, and sometimes 32bit on * 64bit archs. Yuck! */ #if SIZEOF_DEV_T != 8 -void devt_hash_func(const dev_t *p, struct siphash *state) _pure_; +void devt_hash_func(const dev_t *p, struct siphash *state); #else #define devt_hash_func uint64_hash_func #endif diff --git a/src/core/job.c b/src/core/job.c index 24f407ad83..f87b0f7c74 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -1404,11 +1404,13 @@ void job_shutdown_magic(Job *j) { (void) asynchronous_sync(NULL); } -int job_get_timeout(Job *j, usec_t *timeout) { +int job_get_timeout(Job *j, usec_t *ret) { usec_t x = USEC_INFINITY, y = USEC_INFINITY; Unit *u = ASSERT_PTR(ASSERT_PTR(j)->unit); int r; + assert(ret); + if (j->timer_event_source) { r = sd_event_source_get_time(j->timer_event_source, &x); if (r < 0) @@ -1421,10 +1423,12 @@ int job_get_timeout(Job *j, usec_t *timeout) { return r; } - if (x == USEC_INFINITY && y == USEC_INFINITY) + if (x == USEC_INFINITY && y == USEC_INFINITY) { + *ret = 0; return 0; + } - *timeout = MIN(x, y); + *ret = MIN(x, y); return 1; } diff --git a/src/core/job.h b/src/core/job.h index df35e2a5b6..f3e0b93fed 100644 --- a/src/core/job.h +++ b/src/core/job.h @@ -220,7 +220,7 @@ char *job_dbus_path(Job *j); void job_shutdown_magic(Job *j); -int job_get_timeout(Job *j, usec_t *timeout) _pure_; +int job_get_timeout(Job *j, usec_t *ret); bool job_may_gc(Job *j); void job_add_to_gc_queue(Job *j); diff --git a/src/core/transaction.c b/src/core/transaction.c index 997839c553..c3d6ffccc1 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -308,13 +308,11 @@ static void transaction_drop_redundant(Transaction *tr) { } while (again); } -_pure_ static bool unit_matters_to_anchor(Unit *u, Job *job) { - assert(u); +_pure_ static bool job_matters_to_anchor(Job *job) { assert(job); assert(!job->transaction_prev); - /* Checks whether at least one of the jobs for this unit - * matters to the anchor. */ + /* Checks whether at least one of the jobs for this transaction matters to the anchor. */ LIST_FOREACH(transaction, j, job) if (j->matters_to_anchor) @@ -382,7 +380,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi if (strv_push_pair(&array, k->unit->id, (char*) job_type_to_string(k->type)) < 0) log_oom(); - if (!delete && hashmap_get(tr->jobs, k->unit) && !unit_matters_to_anchor(k->unit, k)) + if (!delete && hashmap_contains(tr->jobs, k->unit) && !job_matters_to_anchor(k)) /* Ok, we can drop this one, so let's do so. */ delete = k; @@ -631,7 +629,7 @@ static int transaction_apply( if (j->unit->ignore_on_isolate) continue; - if (hashmap_get(tr->jobs, j->unit)) + if (hashmap_contains(tr->jobs, j->unit)) continue; /* Not invalidating recursively. Avoids triggering @@ -1112,7 +1110,7 @@ static bool shall_stop_on_isolate(Transaction *tr, Unit *u) { return false; /* Is there already something listed for this? */ - if (hashmap_get(tr->jobs, u)) + if (hashmap_contains(tr->jobs, u)) return false; return true; @@ -1172,7 +1170,7 @@ int transaction_add_triggering_jobs(Transaction *tr, Unit *u) { continue; /* Is there already something listed for this? */ - if (hashmap_get(tr->jobs, trigger)) + if (hashmap_contains(tr->jobs, trigger)) continue; r = transaction_add_job_and_dependencies(tr, JOB_STOP, trigger, tr->anchor_job, true, false, false, false, NULL); |