chiark / gitweb /
unit: no need to export variables if we can avoid it
authorLennart Poettering <lennart@poettering.net>
Fri, 29 Mar 2013 21:59:35 +0000 (22:59 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 30 Mar 2013 14:21:54 +0000 (15:21 +0100)
src/shared/unit-name.c
src/shared/unit-name.h
src/systemctl/systemctl.c

index 06bbfac..a809713 100644 (file)
@@ -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",
index 9150dd0..c28d55d 100644 (file)
@@ -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);
 
index f7ae47e..1191c7a 100644 (file)
@@ -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;
 }