unit: no need to export variables if we can avoid it
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user