Quellcode durchsuchen

[settings] Remove now-unused fetchf_named_setting() and storef_named_setting()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown vor 11 Jahren
Ursprung
Commit
bd6c3a1886
2 geänderte Dateien mit 0 neuen und 121 gelöschten Zeilen
  1. 0
    114
      src/core/settings.c
  2. 0
    7
      src/include/ipxe/settings.h

+ 0
- 114
src/core/settings.c Datei anzeigen

@@ -1316,120 +1316,6 @@ int setting_name ( struct settings *settings, struct setting *setting,
1316 1316
 			  setting->name, setting->type->name );
1317 1317
 }
1318 1318
 
1319
-/**
1320
- * Parse and store value of named setting
1321
- *
1322
- * @v name		Name of setting
1323
- * @v default_type	Default type to use, if none specified
1324
- * @v value		Formatted setting data, or NULL
1325
- * @ret rc		Return status code
1326
- */
1327
-int storef_named_setting ( const char *name, struct setting_type *default_type,
1328
-			   const char *value ) {
1329
-	struct settings *settings;
1330
-	struct setting setting;
1331
-	char tmp_name[ strlen ( name ) + 1 ];
1332
-	int rc;
1333
-
1334
-	/* Create modifiable copy of setting name */
1335
-	strcpy ( tmp_name, name );
1336
-
1337
-	/* Parse setting name */
1338
-	if ( ( rc = parse_setting_name ( tmp_name, autovivify_child_settings,
1339
-					 &settings, &setting ) ) != 0 )
1340
-		return rc;
1341
-
1342
-	/* Apply default type if necessary */
1343
-	if ( ! setting.type )
1344
-		setting.type = default_type;
1345
-
1346
-	/* Store setting */
1347
-	if ( ( rc = storef_setting ( settings, &setting, value ) ) != 0 )
1348
-		return rc;
1349
-
1350
-	return 0;
1351
-}
1352
-
1353
-/**
1354
- * Fetch and format value of named setting
1355
- *
1356
- * @v name		Name of setting
1357
- * @v name_buf		Buffer to contain canonicalised name
1358
- * @v name_len		Length of canonicalised name buffer
1359
- * @v value_buf		Buffer to contain formatted value
1360
- * @v value_len		Length of formatted value buffer
1361
- * @ret len		Length of formatted value, or negative error
1362
- */
1363
-int fetchf_named_setting ( const char *name,
1364
-			   char *name_buf, size_t name_len,
1365
-			   char *value_buf, size_t value_len ) {
1366
-	struct settings *settings;
1367
-	struct setting setting;
1368
-	struct settings *origin;
1369
-	char tmp_name[ strlen ( name ) + 1 ];
1370
-	int len;
1371
-	int rc;
1372
-
1373
-	/* Create modifiable copy of setting name */
1374
-	strcpy ( tmp_name, name );
1375
-
1376
-	/* Parse setting name */
1377
-	if ( ( rc = parse_setting_name ( tmp_name, find_child_settings,
1378
-					 &settings, &setting ) ) != 0 )
1379
-		return rc;
1380
-
1381
-	/* Fetch setting */
1382
-	if ( ( len = fetchf_setting ( settings, &setting, value_buf,
1383
-				     value_len ) ) < 0 )
1384
-		return len;
1385
-
1386
-	/* Construct setting name */
1387
-	origin = fetch_setting_origin ( settings, &setting );
1388
-	assert ( origin != NULL );
1389
-	setting_name ( origin, &setting, name_buf, name_len );
1390
-
1391
-	return len;
1392
-}
1393
-
1394
-/**
1395
- * Fetch and format copy of value of named setting
1396
- *
1397
- * @v name		Name of setting
1398
- * @v data		Buffer to allocate and fill with formatted value
1399
- * @ret len		Length of formatted value, or negative error
1400
- *
1401
- * The caller is responsible for eventually freeing the allocated
1402
- * buffer.
1403
- *
1404
- * To allow the caller to distinguish between a non-existent setting
1405
- * and an error in allocating memory for the copy, this function will
1406
- * return success (and a NULL buffer pointer) for a non-existent
1407
- * setting.
1408
- */
1409
-int fetchf_named_setting_copy ( const char *name, char **data ) {
1410
-	int len;
1411
-	int check_len;
1412
-
1413
-	/* Avoid returning uninitialised data on error */
1414
-	*data = NULL;
1415
-
1416
-	/* Fetch formatted value length, and return success if non-existent */
1417
-	len = fetchf_named_setting ( name, NULL, 0, NULL, 0 );
1418
-	if ( len < 0 )
1419
-		return 0;
1420
-
1421
-	/* Allocate buffer */
1422
-	*data = malloc ( len + 1 /* NUL */ );
1423
-	if ( ! *data )
1424
-		return -ENOMEM;
1425
-
1426
-	/* Fetch formatted value */
1427
-	check_len = fetchf_named_setting ( name, NULL, 0, *data,
1428
-					   ( len + 1 /* NUL */ ) );
1429
-	assert ( check_len == len );
1430
-	return len;
1431
-}
1432
-
1433 1319
 /******************************************************************************
1434 1320
  *
1435 1321
  * Setting types

+ 0
- 7
src/include/ipxe/settings.h Datei anzeigen

@@ -315,13 +315,6 @@ extern int fetchf_setting_copy ( struct settings *settings,
315 315
 extern int storef_setting ( struct settings *settings,
316 316
 			    struct setting *setting,
317 317
 			    const char *value );
318
-extern int storef_named_setting ( const char *name,
319
-				  struct setting_type *default_type,
320
-				  const char *value );
321
-extern int fetchf_named_setting ( const char *name, char *name_buf,
322
-				  size_t name_len, char *value_buf,
323
-				  size_t value_len );
324
-extern int fetchf_named_setting_copy ( const char *name, char **data );
325 318
 extern char * expand_settings ( const char *string );
326 319
 
327 320
 extern struct setting_type setting_type_string __setting_type;

Laden…
Abbrechen
Speichern