summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-11-19 17:17:15 -0500
committermidipix <writeonce@midipix.org>2016-11-19 17:17:15 -0500
commit7cd10cbc677e5b800bab04b0c7c9a8662359b6c3 (patch)
tree1b2f34f10d56d5cb8631898d2ee7dd0ea7e22b55
parent146472825ad32ace11d787719dc21c1744775cb2 (diff)
downloadpemagine-7cd10cbc677e5b800bab04b0c7c9a8662359b6c3.tar.bz2
pemagine-7cd10cbc677e5b800bab04b0c7c9a8662359b6c3.tar.xz
pe_impl_strlen_ansi(): code maintenance.
-rw-r--r--src/internal/pe_impl.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/internal/pe_impl.c b/src/internal/pe_impl.c
index c586b63..3edbe16 100644
--- a/src/internal/pe_impl.c
+++ b/src/internal/pe_impl.c
@@ -10,18 +10,17 @@
int32_t pe_impl_strlen_ansi(const char * str)
{
- char * ch;
- char * upper_bound;
+ const char * ch;
+ const char * upper_bound;
- /* sanity check */
- upper_bound = (char *)str + PE_STR_MAX_SYMBOL_LEN_ALLOWED;
+ upper_bound = str + PE_STR_MAX_SYMBOL_LEN_ALLOWED;
- for (ch = (char *)str; (ch < upper_bound) && (*ch); ch++);
+ for (ch=str; *ch && ch<upper_bound; )
+ ch++;
- if (ch < upper_bound)
- return (uint32_t)(ch - str);
- else
- return -1;
+ return (ch < upper_bound)
+ ? ch - str
+ : -1;
}