ACK: [PATCH] lib: fwts_formatting: make width parameter size_t
ivanhu
ivan.hu at canonical.com
Thu Sep 21 09:17:13 UTC 2017
On 09/08/2017 05:43 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Lengths of string objects should really be size_t rather than int.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/include/fwts_formatting.h | 2 +-
> src/lib/src/fwts_formatting.c | 8 ++++----
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/lib/include/fwts_formatting.h b/src/lib/include/fwts_formatting.h
> index 3431c6aa..036f09e1 100644
> --- a/src/lib/include/fwts_formatting.h
> +++ b/src/lib/include/fwts_formatting.h
> @@ -22,6 +22,6 @@
>
> #include "fwts_list.h"
>
> -fwts_list *fwts_format_text(const char *text, const int width);
> +fwts_list *fwts_format_text(const char *text, const size_t width);
>
> #endif
> diff --git a/src/lib/src/fwts_formatting.c b/src/lib/src/fwts_formatting.c
> index 3b413bd3..0f661d5c 100644
> --- a/src/lib/src/fwts_formatting.c
> +++ b/src/lib/src/fwts_formatting.c
> @@ -30,9 +30,9 @@
> * duplicate a portion of a line of text, from start to end up to
> * a maximum of width characters
> */
> -static char *dup_line(const char *start, const char *end, const int width)
> +static char *dup_line(const char *start, const char *end, const size_t width)
> {
> - int maxlen;
> + size_t maxlen;
> char *buffer;
> char *bufptr;
>
> @@ -83,9 +83,9 @@ static char *format_remove_multiple_whitespaces(const char *text)
> * given a text string, format it into a list of lines of
> * text to a given width.
> */
> -fwts_list *fwts_format_text(const char *text, const int width)
> +fwts_list *fwts_format_text(const char *text, const size_t width)
> {
> - int linelen = 0;
> + size_t linelen = 0;
> char *lastspace = NULL;
> char *tidied_text;
> char *linestart;
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list