mirror of
https://github.com/xcat2/xNBA.git
synced 2025-04-15 09:39:26 +00:00
[settings] Eliminate call to store_named_setting() in nslookup.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
129a70631a
commit
44fd309044
@ -46,7 +46,7 @@ struct nslookup {
|
||||
struct interface resolver;
|
||||
|
||||
/** Setting name */
|
||||
const char *setting_name;
|
||||
char *setting_name;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -71,7 +71,9 @@ static void nslookup_close ( struct nslookup *nslookup, int rc ) {
|
||||
static void nslookup_resolv_done ( struct nslookup *nslookup,
|
||||
struct sockaddr *sa ) {
|
||||
struct sockaddr_in *sin;
|
||||
struct setting_type *type;
|
||||
struct setting_type *default_type;
|
||||
struct settings *settings;
|
||||
struct setting setting;
|
||||
void *data;
|
||||
size_t len;
|
||||
int rc;
|
||||
@ -82,16 +84,25 @@ static void nslookup_resolv_done ( struct nslookup *nslookup,
|
||||
sin = ( ( struct sockaddr_in * ) sa );
|
||||
data = &sin->sin_addr;
|
||||
len = sizeof ( sin->sin_addr );
|
||||
type = &setting_type_ipv4;
|
||||
default_type = &setting_type_ipv4;
|
||||
break;
|
||||
default:
|
||||
rc = -ENOTSUP;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Save in specified setting */
|
||||
if ( ( rc = store_named_setting ( nslookup->setting_name, type,
|
||||
data, len ) ) != 0 )
|
||||
/* Parse specified setting name */
|
||||
if ( ( rc = parse_setting_name ( nslookup->setting_name,
|
||||
autovivify_child_settings, &settings,
|
||||
&setting ) ) != 0 )
|
||||
goto err;
|
||||
|
||||
/* Apply default type if necessary */
|
||||
if ( ! setting.type )
|
||||
setting.type = default_type;
|
||||
|
||||
/* Store in specified setting */
|
||||
if ( ( rc = store_setting ( settings, &setting, data, len ) ) != 0 )
|
||||
goto err;
|
||||
|
||||
err:
|
||||
|
Loading…
x
Reference in New Issue
Block a user