diff options
author | Michael Brown <mcb30@ipxe.org> | 2013-07-22 14:36:00 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2013-07-22 16:39:32 +0100 |
commit | bd6c3a1886faaab0028e099db9a64c16dea93f33 (patch) | |
tree | 9c098f0b2a822c28f506abca216255b25690beb2 /src/core/settings.c | |
parent | 652abb67069fa15802e3a30d09b476e9514d9110 (diff) | |
download | ipxe-bd6c3a1886faaab0028e099db9a64c16dea93f33.zip ipxe-bd6c3a1886faaab0028e099db9a64c16dea93f33.tar.gz ipxe-bd6c3a1886faaab0028e099db9a64c16dea93f33.tar.bz2 |
[settings] Remove now-unused fetchf_named_setting() and storef_named_setting()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/settings.c')
-rw-r--r-- | src/core/settings.c | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/src/core/settings.c b/src/core/settings.c index ab44dea..76d7f6a 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -1316,120 +1316,6 @@ int setting_name ( struct settings *settings, struct setting *setting, setting->name, setting->type->name ); } -/** - * Parse and store value of named setting - * - * @v name Name of setting - * @v default_type Default type to use, if none specified - * @v value Formatted setting data, or NULL - * @ret rc Return status code - */ -int storef_named_setting ( const char *name, struct setting_type *default_type, - const char *value ) { - struct settings *settings; - struct setting setting; - char tmp_name[ strlen ( name ) + 1 ]; - int rc; - - /* Create modifiable copy of setting name */ - strcpy ( tmp_name, name ); - - /* Parse setting name */ - if ( ( rc = parse_setting_name ( tmp_name, autovivify_child_settings, - &settings, &setting ) ) != 0 ) - return rc; - - /* Apply default type if necessary */ - if ( ! setting.type ) - setting.type = default_type; - - /* Store setting */ - if ( ( rc = storef_setting ( settings, &setting, value ) ) != 0 ) - return rc; - - return 0; -} - -/** - * Fetch and format value of named setting - * - * @v name Name of setting - * @v name_buf Buffer to contain canonicalised name - * @v name_len Length of canonicalised name buffer - * @v value_buf Buffer to contain formatted value - * @v value_len Length of formatted value buffer - * @ret len Length of formatted value, or negative error - */ -int fetchf_named_setting ( const char *name, - char *name_buf, size_t name_len, - char *value_buf, size_t value_len ) { - struct settings *settings; - struct setting setting; - struct settings *origin; - char tmp_name[ strlen ( name ) + 1 ]; - int len; - int rc; - - /* Create modifiable copy of setting name */ - strcpy ( tmp_name, name ); - - /* Parse setting name */ - if ( ( rc = parse_setting_name ( tmp_name, find_child_settings, - &settings, &setting ) ) != 0 ) - return rc; - - /* Fetch setting */ - if ( ( len = fetchf_setting ( settings, &setting, value_buf, - value_len ) ) < 0 ) - return len; - - /* Construct setting name */ - origin = fetch_setting_origin ( settings, &setting ); - assert ( origin != NULL ); - setting_name ( origin, &setting, name_buf, name_len ); - - return len; -} - -/** - * Fetch and format copy of value of named setting - * - * @v name Name of setting - * @v data Buffer to allocate and fill with formatted value - * @ret len Length of formatted value, or negative error - * - * The caller is responsible for eventually freeing the allocated - * buffer. - * - * To allow the caller to distinguish between a non-existent setting - * and an error in allocating memory for the copy, this function will - * return success (and a NULL buffer pointer) for a non-existent - * setting. - */ -int fetchf_named_setting_copy ( const char *name, char **data ) { - int len; - int check_len; - - /* Avoid returning uninitialised data on error */ - *data = NULL; - - /* Fetch formatted value length, and return success if non-existent */ - len = fetchf_named_setting ( name, NULL, 0, NULL, 0 ); - if ( len < 0 ) - return 0; - - /* Allocate buffer */ - *data = malloc ( len + 1 /* NUL */ ); - if ( ! *data ) - return -ENOMEM; - - /* Fetch formatted value */ - check_len = fetchf_named_setting ( name, NULL, 0, *data, - ( len + 1 /* NUL */ ) ); - assert ( check_len == len ); - return len; -} - /****************************************************************************** * * Setting types |