chiark / gitweb /
job: use a lookup table for merging of job types
authorMichal Schmidt <mschmidt@redhat.com>
Thu, 5 Apr 2012 06:34:05 +0000 (08:34 +0200)
committerMichal Schmidt <mschmidt@redhat.com>
Thu, 5 Apr 2012 09:54:13 +0000 (11:54 +0200)
commit348e27fedfd4cdd2238ff31a46785a70b9dc6fc0
treed6f22a9c3fd626aaa5605d41d59a424d8b91a36d
parentb8217b7bd5fd171916a095b150fad4c3a37f5a41
job: use a lookup table for merging of job types

It is easier to see what job_type_merge() is doing when the merging
rules are written in the form of a table.

job_type_is_superset() contained redundant information. It can be
simplified to a simple rule: Type A is a superset of B iff merging A
with B gives A.

Two job types are conflicting iff they are not mergeable.

Make job_type_lookup_merge() the core function to decide the type
merging. All other job_type_*() are just short wrappers around it.
They can be inline.

test-job-type gives the same results as before.
btw, the systemd binary is smaller by almost 1 KB.
src/job.c
src/job.h