ACK: [PATCH] lib: fwts_formatting: use simpler style for assigments
Alex Hung
alex.hung at canonical.com
Tue Jun 11 16:31:56 UTC 2019
On 2019-06-11 2:13 a.m., Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Don't do double assignments and a null check in one go. Use a
> simpler code style to match coding style and clean up cppcheck
> warnings.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/src/fwts_formatting.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_formatting.c b/src/lib/src/fwts_formatting.c
> index 4e910d51..aee19388 100644
> --- a/src/lib/src/fwts_formatting.c
> +++ b/src/lib/src/fwts_formatting.c
> @@ -40,9 +40,11 @@ static char *dup_line(const char *start, const char *end, const size_t width)
> if (maxlen < width)
> maxlen = width;
>
> - if ((bufptr = buffer = calloc(1, maxlen + 1)) == NULL)
> + buffer = calloc(1, maxlen + 1);
> + if (!buffer)
> return NULL;
>
> + bufptr = buffer;
> while (*start && start < end)
> *bufptr++ = *start++;
>
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list