From c11cc921bc68bde380dddbdef3dd347df4fce7c0 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 22 Jan 2011 13:06:04 +0100 Subject: [PATCH] The xml output is dirty and marked as FIXME The xml output does not use output file as all other outputs, it has sections here and there while everything is supposed to be in output.c, and finally the unnecessary field analysis loop made program about 20% slower when xml was not asked. Signed-off-by: Sami Kerola --- src/dhcpd-pools.c | 2 ++ src/getdata.c | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index 78a6ce0..e3467cb 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -246,6 +246,7 @@ int main(int argc, char **argv) shared_net_names + strlen(shared_net_names) + 1, shared_networks); + /* FIXME: move to output.c and use FILE *outfile */ if ((config.output_format[0] == 'x') || (config.output_format[0] == 'X')) { printf("\n"); @@ -271,6 +272,7 @@ int main(int argc, char **argv) if (errno == 25) errno = 0; + /* FIXME: move to output.c and use FILE *outfile */ if ((config.output_format[0] == 'x') || (config.output_format[0] == 'X')) { printf("\n"); diff --git a/src/getdata.c b/src/getdata.c index 2fc1f5f..430468c 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -134,16 +134,16 @@ int parse_leases(void) num_backups++; } - if ((sw_active_lease == 1) + /* FIXME: move to output.c and use FILE *outfile */ + if ((config.output_format[0] == 'X') + && (sw_active_lease == 1) && (strstr(line, "hardware ethernet"))) { nth_field(3, macstring, line); macstring[strlen(macstring) - 1] = '\0'; - if (config.output_format[0] == 'X') { - printf - ("\n\t%s\n\t%s\n\n", - ipstring, macstring); - }; + printf + ("\n\t%s\n\t%s\n\n", + ipstring, macstring); } if ((leasesmallocsize < num_leases) || -- 1.7.10.4