[Sound-open-firmware] [PATCH] Use "const char*" instead of "char*" in rstrlen().
From: Yan Wang yan.wang@linux.intel.com
It is unnecessary to use "char*" for calculating string length.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- src/include/reef/alloc.h | 2 +- src/lib/lib.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/include/reef/alloc.h b/src/include/reef/alloc.h index a589959..4e8a630 100644 --- a/src/include/reef/alloc.h +++ b/src/include/reef/alloc.h @@ -82,7 +82,7 @@ void rbfree(void *ptr); /* utility */ void bzero(void *s, size_t n); void *memset(void *s, int c, size_t n); -int rstrlen(char *s); +int rstrlen(const char *s);
/* Heap save/restore contents and context for PM D0/D3 events */ uint32_t mm_pm_context_size(void); diff --git a/src/lib/lib.c b/src/lib/lib.c index a1c9933..7e4c09d 100644 --- a/src/lib/lib.c +++ b/src/lib/lib.c @@ -99,9 +99,9 @@ void *memset(void *s, int c, size_t n) }
/* generic strlen - TODO: can be optimsed for ARCH ? */ -int rstrlen(char *s) +int rstrlen(const char *s) { - char *p = s; + const char *p = s;
while(*p++ != 0); return (p - s) - 1;
On Thu, 2017-10-12 at 16:34 +0800, yan.wang@linux.intel.com wrote:
From: Yan Wang yan.wang@linux.intel.com
It is unnecessary to use "char*" for calculating string length.
Signed-off-by: Yan Wang yan.wang@linux.intel.com
src/include/reef/alloc.h | 2 +- src/lib/lib.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
Applied.
participants (2)
-
Liam Girdwood
-
yan.wang@linux.intel.com