Patchwork lib: fwts_stringextras: use size_t instead of int

login
register
mail settings
Submitter Colin King
Date April 10, 2012, 2:44 p.m.
Message ID <1334069085-4028-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/151606/
State Accepted
Headers show

Comments

Colin King - April 10, 2012, 2:44 p.m.
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_stringextras.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Alex Hung - April 11, 2012, 2:13 a.m.
On 04/10/2012 10:44 PM, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King<colin.king@canonical.com>
> ---
>   src/lib/src/fwts_stringextras.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_stringextras.c b/src/lib/src/fwts_stringextras.c
> index babf2ed..0143477 100644
> --- a/src/lib/src/fwts_stringextras.c
> +++ b/src/lib/src/fwts_stringextras.c
> @@ -27,7 +27,7 @@
>    */
>   void fwts_chop_newline(char *str)
>   {
> -	int len;
> +	size_t len;
>
>   	if (!str)
>   		return;
> @@ -47,7 +47,7 @@ void fwts_chop_newline(char *str)
>    */
>   char *fwts_realloc_strcat(char *orig, const char *newstr)
>   {
> -	int newlen = strlen(newstr);
> +	size_t newlen = strlen(newstr);
>
>   	if (orig) {
>   		if ((orig = realloc(orig, strlen(orig) + newlen + 1)) == NULL)
Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin - April 11, 2012, 5:17 a.m.
On Wed, Apr 11, 2012 at 10:13 AM, Alex Hung <alex.hung@canonical.com> wrote:
> On 04/10/2012 10:44 PM, Colin King wrote:
>>
>> From: Colin Ian King<colin.king@canonical.com>
>>
>> Signed-off-by: Colin Ian King<colin.king@canonical.com>
>> ---
>>  src/lib/src/fwts_stringextras.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/lib/src/fwts_stringextras.c
>> b/src/lib/src/fwts_stringextras.c
>> index babf2ed..0143477 100644
>> --- a/src/lib/src/fwts_stringextras.c
>> +++ b/src/lib/src/fwts_stringextras.c
>> @@ -27,7 +27,7 @@
>>   */
>>  void fwts_chop_newline(char *str)
>>  {
>> -       int len;
>> +       size_t len;
>>
>>        if (!str)
>>                return;
>> @@ -47,7 +47,7 @@ void fwts_chop_newline(char *str)
>>   */
>>  char *fwts_realloc_strcat(char *orig, const char *newstr)
>>  {
>> -       int newlen = strlen(newstr);
>> +       size_t newlen = strlen(newstr);
>>
>>        if (orig) {
>>                if ((orig = realloc(orig, strlen(orig) + newlen + 1)) ==
>> NULL)
>
> Acked-by: Alex Hung <alex.hung@canonical.com>
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>

Patch

diff --git a/src/lib/src/fwts_stringextras.c b/src/lib/src/fwts_stringextras.c
index babf2ed..0143477 100644
--- a/src/lib/src/fwts_stringextras.c
+++ b/src/lib/src/fwts_stringextras.c
@@ -27,7 +27,7 @@ 
  */
 void fwts_chop_newline(char *str)
 {
-	int len;
+	size_t len;
 
 	if (!str)
 		return;
@@ -47,7 +47,7 @@  void fwts_chop_newline(char *str)
  */
 char *fwts_realloc_strcat(char *orig, const char *newstr)
 {
-	int newlen = strlen(newstr);
+	size_t newlen = strlen(newstr);
 
 	if (orig) {
 		if ((orig = realloc(orig, strlen(orig) + newlen + 1)) == NULL)