[SLOF] [PATCH slof v2 4/4] dhcp: Remove duplicated strtoip()

Thomas Huth thuth at redhat.com
Thu Jan 21 19:54:02 AEDT 2016


On 21.01.2016 02:39, Alexey Kardashevskiy wrote:
> There is another implementation in netapps/args.c which is used by
> netboot.c and ping.c so switch to it.
> 
> Suggested-by: Thomas Huth <thuth at redhat.com>
> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
> ---
>  clients/net-snk/app/netlib/dhcp.c | 50 ++-------------------------------------
>  1 file changed, 2 insertions(+), 48 deletions(-)
> 
> diff --git a/clients/net-snk/app/netlib/dhcp.c b/clients/net-snk/app/netlib/dhcp.c
> index 6a1f802..9659eb7 100644
> --- a/clients/net-snk/app/netlib/dhcp.c
> +++ b/clients/net-snk/app/netlib/dhcp.c
> @@ -48,6 +48,7 @@
>  #include <ipv4.h>
>  #include <udp.h>
>  #include <dns.h>
> +#include <netapps/args.h>
>  
>  #include <stdio.h>
>  #include <string.h>
> @@ -157,9 +158,6 @@ static void dhcp_send_discover(int fd);
>  
>  static void dhcp_send_request(int fd);
>  
> -static uint8_t strtoip(int8_t * str, uint32_t * ip);
> -
> -
>  /***************************** LOCAL VARIABLES ***************************/
>  
>  static uint8_t  ether_packet[ETH_MTU_SIZE];
> @@ -214,7 +212,7 @@ int32_t dhcpv4(char *ret_buffer, filename_ip_t *fn_ip)
>  	}
>  	else {
>  		// TFTP server defined by its name
> -		if (!strtoip(dhcp_tftp_name, &(dhcp_tftp_ip))) {
> +		if (!strtoip(dhcp_tftp_name, (uint8_t *)&(dhcp_tftp_ip))) {

While you're at it, you could also remove the superfluous parenthesis
here ... ah, well, let's not start that discussion again.

Reviewed-by: Thomas Huth <thuth at redhat.com>



More information about the SLOF mailing list