mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-17 00:06:59 +00:00
analysis: shared networks to be linked list
This way memory is allocated only for items that are in use, and walking through shared network items is also more straightforward. As an unfortunate side effect in --perfdata output shared networks are no longer printed in reverse order. This should be a cosmetic issue. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
a237c11d5a
commit
ef5421ed05
8 changed files with 84 additions and 100 deletions
|
|
@ -78,12 +78,11 @@ static int return_limit(const char c)
|
|||
* initializations, etc are here. */
|
||||
static void prepare_memory(struct conf_t *state)
|
||||
{
|
||||
/* The SHARED_NETWORKS is a static value from defaults.h */
|
||||
state->shared_networks = xcalloc(sizeof(struct shared_network_t), SHARED_NETWORKS);
|
||||
state->ranges = xmalloc(sizeof(struct range_t) * state->ranges_size);
|
||||
|
||||
/* First shared network entry is all networks */
|
||||
state->shared_networks->name = xstrdup("All networks");
|
||||
state->shared_net_root = xcalloc(sizeof(struct shared_network_t), 1);
|
||||
state->shared_net_root->name = xstrdup("All networks");
|
||||
state->shared_net_head = state->shared_net_root;
|
||||
}
|
||||
|
||||
/*! \brief Start of execution. Parse options, and call other other
|
||||
|
|
@ -306,7 +305,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
/* Do the job */
|
||||
parse_config(&state, 1, state.dhcpdconf_file, state.shared_networks);
|
||||
parse_config(&state, 1, state.dhcpdconf_file, state.shared_net_root);
|
||||
if (output_format == 'X' || output_format == 'J')
|
||||
parse_leases(&state, 1);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue