Merge pull request #27596 from yuwata/drop-pure

drop two more inappropriate _pure_ attributes and several cleanups
This commit is contained in:
Yu Watanabe
2023-05-11 16:49:40 +09:00
committed by GitHub
4 changed files with 15 additions and 13 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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);