Commit c5e21daf authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

assert fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2278 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 6 additions and 4 deletions
+6 -4
......@@ -268,6 +268,8 @@ int mb_cur_max(void)
* length. */
char *make_mbchar(unsigned int chr, char *chr_mb, int *chr_mb_len)
{
assert(chr_mb != NULL && chr_mb_len != NULL);
#ifdef NANO_WIDE
if (!ISSET(NO_UTF8)) {
*chr_mb_len = wctomb(chr_mb, chr);
......@@ -441,8 +443,6 @@ int nstrcasecmp(const char *s1, const char *s2)
/* This function is equivalent to strcasecmp() for multibyte strings. */
int mbstrcasecmp(const char *s1, const char *s2)
{
assert(s1 != NULL && s2 != NULL);
#ifdef NANO_WIDE
if (!ISSET(NO_UTF8)) {
char *s1_mb = charalloc(mb_cur_max());
......@@ -450,6 +450,8 @@ int mbstrcasecmp(const char *s1, const char *s2)
int s1_mb_len, s2_mb_len;
wchar_t ws1, ws2;
assert(s1 != NULL && s2 != NULL);
while (*s1 != '\0' && *s2 != '\0') {
s1_mb_len = parse_mbchar(s1, s1_mb
#ifdef NANO_WIDE
......@@ -518,8 +520,6 @@ int nstrncasecmp(const char *s1, const char *s2, size_t n)
* strings. */
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
{
assert(s1 != NULL && s2 != NULL);
#ifdef NANO_WIDE
if (!ISSET(NO_UTF8)) {
char *s1_mb = charalloc(mb_cur_max());
......@@ -527,6 +527,8 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
int s1_mb_len, s2_mb_len;
wchar_t ws1, ws2;
assert(s1 != NULL && s2 != NULL);
while (n > 0 && *s1 != '\0' && *s2 != '\0') {
s1_mb_len = parse_mbchar(s1, s1_mb
#ifdef NANO_WIDE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment