]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[settings] Remove now-unused fetchf_named_setting() and storef_named_setting()
authorMichael Brown <mcb30@ipxe.org>
Mon, 22 Jul 2013 13:36:00 +0000 (14:36 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 22 Jul 2013 15:39:32 +0000 (16:39 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/settings.c
src/include/ipxe/settings.h

index ab44dea9f7d7e037a2973544eabd15dad7023ac1..76d7f6a6caa94ffe300f9f2773453472c39129f0 100644 (file)
@@ -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
index 2faf4d795f54f7cfcea72314d75c2805076f7d47..c7287ebb257a05b6c97f0ef22386f49039a4d43f 100644 (file)
@@ -315,13 +315,6 @@ extern int fetchf_setting_copy ( struct settings *settings,
 extern int storef_setting ( struct settings *settings,
                            struct setting *setting,
                            const char *value );
-extern int storef_named_setting ( const char *name,
-                                 struct setting_type *default_type,
-                                 const char *value );
-extern int fetchf_named_setting ( const char *name, char *name_buf,
-                                 size_t name_len, char *value_buf,
-                                 size_t value_len );
-extern int fetchf_named_setting_copy ( const char *name, char **data );
 extern char * expand_settings ( const char *string );
 
 extern struct setting_type setting_type_string __setting_type;