From c5e21dafb7ef1372200269ecfc47835f35bb3796 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sun, 16 Jan 2005 18:58:03 +0000
Subject: [PATCH] assert fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2278 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 src/chars.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/chars.c b/src/chars.c
index f54441b6..1eb11775 100644
--- a/src/chars.c
+++ b/src/chars.c
@@ -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
-- 
GitLab