summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-29 22:59:35 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-30 15:21:54 +0100
commit830f01f0bc1c60d765109f86ae7385caff0ed6ac (patch)
tree7dbd2bb66c4bcdd48c3ec33ca3621f67284f35bd
parent5a494eacbbe93dd582a894a9f1e60ae58fa4e400 (diff)
unit: no need to export variables if we can avoid it
-rw-r--r--src/shared/unit-name.c4
-rw-r--r--src/shared/unit-name.h2
-rw-r--r--src/systemctl/systemctl.c17
3 files changed, 13 insertions, 10 deletions
diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c
index 06bbfacb00..a809713595 100644
--- a/src/shared/unit-name.c
+++ b/src/shared/unit-name.c
@@ -33,7 +33,7 @@
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
":-_.\\"
-const char* const unit_type_table[_UNIT_TYPE_MAX] = {
+static const char* const unit_type_table[_UNIT_TYPE_MAX] = {
[UNIT_SERVICE] = "service",
[UNIT_SOCKET] = "socket",
[UNIT_TARGET] = "target",
@@ -48,7 +48,7 @@ const char* const unit_type_table[_UNIT_TYPE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(unit_type, UnitType);
-const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = {
+static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = {
[UNIT_STUB] = "stub",
[UNIT_LOADED] = "loaded",
[UNIT_ERROR] = "error",
diff --git a/src/shared/unit-name.h b/src/shared/unit-name.h
index 9150dd0b3f..c28d55d3e8 100644
--- a/src/shared/unit-name.h
+++ b/src/shared/unit-name.h
@@ -53,11 +53,9 @@ enum UnitLoadState {
_UNIT_LOAD_STATE_INVALID = -1
};
-extern const char* const unit_type_table[];
const char *unit_type_to_string(UnitType i);
UnitType unit_type_from_string(const char *s);
-extern const char* const unit_load_state_table[];
const char *unit_load_state_to_string(UnitLoadState i);
UnitLoadState unit_load_state_from_string(const char *s);
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index f7ae47e7c7..1191c7a1e1 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4243,16 +4243,21 @@ static int runlevel_help(void) {
static int help_types(void) {
int i;
+ const char *t;
puts("Available unit types:");
- for(i = UNIT_SERVICE; i < _UNIT_TYPE_MAX; i++)
- if (unit_type_table[i])
- puts(unit_type_table[i]);
+ for(i = 0; i < _UNIT_TYPE_MAX; i++) {
+ t = unit_type_to_string(i);
+ if (t)
+ puts(t);
+ }
puts("\nAvailable unit load states: ");
- for(i = UNIT_STUB; i < _UNIT_LOAD_STATE_MAX; i++)
- if (unit_type_table[i])
- puts(unit_load_state_table[i]);
+ for(i = 0; i < _UNIT_LOAD_STATE_MAX; i++) {
+ t = unit_load_state_to_string(i);
+ if (t)
+ puts(t);
+ }
return 0;
}