|
@@ -1060,6 +1060,27 @@ parse_setting_name ( const char *name,
|
1060
|
1060
|
return 0;
|
1061
|
1061
|
}
|
1062
|
1062
|
|
|
1063
|
+/**
|
|
1064
|
+ * Return full setting name
|
|
1065
|
+ *
|
|
1066
|
+ * @v settings Settings block, or NULL
|
|
1067
|
+ * @v setting Setting
|
|
1068
|
+ * @v buf Buffer
|
|
1069
|
+ * @v len Length of buffer
|
|
1070
|
+ * @ret len Length of setting name, or negative error
|
|
1071
|
+ */
|
|
1072
|
+int setting_name ( struct settings *settings, struct setting *setting,
|
|
1073
|
+ char *buf, size_t len ) {
|
|
1074
|
+ const char *name;
|
|
1075
|
+
|
|
1076
|
+ if ( ! settings )
|
|
1077
|
+ settings = &settings_root;
|
|
1078
|
+
|
|
1079
|
+ name = settings_name ( settings );
|
|
1080
|
+ return snprintf ( buf, len, "%s%s%s:%s", name, ( name[0] ? "/" : "" ),
|
|
1081
|
+ setting->name, setting->type->name );
|
|
1082
|
+}
|
|
1083
|
+
|
1063
|
1084
|
/**
|
1064
|
1085
|
* Parse and store value of named setting
|
1065
|
1086
|
*
|
|
@@ -1101,7 +1122,6 @@ int fetchf_named_setting ( const char *name,
|
1101
|
1122
|
struct settings *settings;
|
1102
|
1123
|
struct setting setting;
|
1103
|
1124
|
struct settings *origin;
|
1104
|
|
- const char *origin_name;
|
1105
|
1125
|
char tmp_name[ strlen ( name ) + 1 ];
|
1106
|
1126
|
int rc;
|
1107
|
1127
|
|
|
@@ -1118,10 +1138,7 @@ int fetchf_named_setting ( const char *name,
|
1118
|
1138
|
/* Construct setting name */
|
1119
|
1139
|
origin = fetch_setting_origin ( settings, &setting );
|
1120
|
1140
|
assert ( origin != NULL );
|
1121
|
|
- origin_name = settings_name ( origin );
|
1122
|
|
- snprintf ( name_buf, name_len, "%s%s%s:%s",
|
1123
|
|
- origin_name, ( origin_name[0] ? "/" : "" ),
|
1124
|
|
- setting.name, setting.type->name );
|
|
1141
|
+ setting_name ( origin, &setting, name_buf, name_len );
|
1125
|
1142
|
|
1126
|
1143
|
return 0;
|
1127
|
1144
|
}
|