[SLOF] [PATCH slof] dhcp: Fix coding style
Thomas Huth
thuth at redhat.com
Wed Jan 20 18:22:56 AEDT 2016
On 20.01.2016 07:34, Alexey Kardashevskiy wrote:
> This restyles function prototypes:
> - return types on the same line;
> - opening brace is on the next line.
>
> This replaces [><]* with "*" as >< are also used to resolve merge
> conflicts.
Great, thanks, these were always annoying me! Now it's just ipv4.c,
ethernet.c, udp.c and tcp.c that are left ;-)
> This removes trailing spaces.
>
> This replaces some local variable types from signed to unsigned to
> fix some gcc warnings.
bisecting later would be easier if you'd separate the functional changes
from the cosmetic changes.
...
> @@ -499,8 +487,9 @@ dhcp_decode_options(uint8_t opt_field[], uint32_t opt_len,
> * FALSE - error condition occurs.
> */
> static int8_t dhcp_merge_options(uint8_t dst_options[], uint32_t * dst_len,
> - uint8_t src_options[], uint32_t src_len) {
> - int32_t dst_offset, src_offset = 0;
> + uint8_t src_options[], uint32_t src_len)
> +{
> + uint32_t dst_offset, src_offset = 0;
>
> // remove ENDOPT if presented
> if (dhcp_find_option(dst_options, * dst_len, DHCP_ENDOPT, (uint32_t *) &dst_offset))
I think you could now also remove the typecast in above statement ...
and also from the later call to dhcp_find_option().
> -static uint8_t
> -strtoip(int8_t * str, uint32_t * ip) {
> +static uint8_t strtoip(int8_t * str, uint32_t * ip)
> +{
> int8_t ** ptr = &str;
> int16_t i = 0, res, len;
> char octet[256];
By the way, that stroip function seems to be a duplicate from
netapps/args.c ... it could maybe be removed completely (with a separate
patch, of course).
Thomas
More information about the SLOF
mailing list