summaryrefslogtreecommitdiff
path: root/src/core/job.c
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-01-31 13:26:09 +0000
committerEvgeny Vereshchagin <evvers@ya.ru>2016-01-31 14:23:46 +0000
commit94bd732348535de399f8f003e3a1cbc8a81ab839 (patch)
treee58370a3eb36736f122970befd4dcb4933400e63 /src/core/job.c
parent61ea63f1ab7f47cc7490986748f3d240c06b54a5 (diff)
core: refactoring: add job_type_to_access_method
remove duplication
Diffstat (limited to 'src/core/job.c')
-rw-r--r--src/core/job.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/job.c b/src/core/job.c
index 4e111ffb46..d8fdf1b53f 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -1240,3 +1240,15 @@ static const char* const job_result_table[_JOB_RESULT_MAX] = {
};
DEFINE_STRING_TABLE_LOOKUP(job_result, JobResult);
+
+const char* job_type_to_access_method(JobType t) {
+ assert(t >= 0);
+ assert(t < _JOB_TYPE_MAX);
+
+ if (IN_SET(t, JOB_START, JOB_RESTART, JOB_TRY_RESTART))
+ return "start";
+ else if (t == JOB_STOP)
+ return "stop";
+ else
+ return "reload";
+}