[hackers] [sbase] libutf: Change return type of utftorunestr to size_t || Michael Forney

From: <git_AT_suckless.org>
Date: Tue, 7 Apr 2020 10:51:50 +0200 (CEST)

commit 28063c02f4dd8b1bf8c0b29d9e2b8f575382a047
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Tue Apr 7 01:25:22 2020 -0700
Commit: Michael Forney <mforney_AT_mforney.org>
CommitDate: Tue Apr 7 01:25:22 2020 -0700

    libutf: Change return type of utftorunestr to size_t
    
    It returns the size of the rune array, so size_t is the right type
    to use here.

diff --git a/libutf/utftorunestr.c b/libutf/utftorunestr.c
index 005fe8a..ae3ad50 100644
--- a/libutf/utftorunestr.c
+++ b/libutf/utftorunestr.c
_AT_@ -1,12 +1,12 @@
 /* See LICENSE file for copyright and license details. */
 #include "../utf.h"
 
-int
+size_t
 utftorunestr(const char *str, Rune *r)
 {
- int i, n;
+ size_t i, n;
 
- for(i = 0; (n = chartorune(&r[i], str)) && r[i]; i++)
+ for (i = 0; (n = chartorune(&r[i], str)) && r[i]; i++)
                 str += n;
 
         return i;
diff --git a/utf.h b/utf.h
index 23a9887..18a41da 100644
--- a/utf.h
+++ b/utf.h
_AT_@ -59,7 +59,7 @@ int isxdigitrune(Rune);
 Rune tolowerrune(Rune);
 Rune toupperrune(Rune);
 
-int utftorunestr(const char*, Rune *);
+size_t utftorunestr(const char *, Rune *);
 
 int fgetrune(Rune *, FILE *);
 int efgetrune(Rune *, FILE *, const char *);
Received on Tue Apr 07 2020 - 10:51:50 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 07 2020 - 11:00:36 CEST