about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2006-01-09 17:58:57 +0000
committerWayne Davison <wayned@users.sourceforge.net>2006-01-09 17:58:57 +0000
commit00465c76fba612037e4ad1fd1b84e6045b674e08 (patch)
treee3858d085470bf2ca60ba4db5c24e1e744702cbd
parentcc890edcb58683943a3af0e7e0d53a42496acd28 (diff)
downloadzsh-00465c76fba612037e4ad1fd1b84e6045b674e08.tar.gz
zsh-00465c76fba612037e4ad1fd1b84e6045b674e08.tar.xz
zsh-00465c76fba612037e4ad1fd1b84e6045b674e08.zip
Changed the name of the "ret" variable in mb_niceformat() to "cnt"
because "ret" is usually used for a variable name to hold the
return value of the function.  Also, changed the test when
checking for a \0 to only check if "cnt" is 0, since we must
always change a value of 0 to 1.
-rw-r--r--Src/Zle/zle_utils.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index f4f3869b8..c4abad69d 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -275,36 +275,35 @@ stringaszleline(char *instr, int incs, int *outll, int *outsz, int *outcs)
 	memset(&ps, '\0', sizeof(ps));
 
 	while (ll > 0) {
-	    size_t ret = mbrtowc(outptr, inptr, ll, &ps);
+	    size_t cnt = mbrtowc(outptr, inptr, ll, &ps);
 
 	    /*
 	     * At this point we don't handle either incomplete (-2) or
 	     * invalid (-1) multibyte sequences.  Use the current length
 	     * and return.
 	     */
-	    if (ret == (size_t)-1 || ret == (size_t)-2)
+	    if (cnt == (size_t)-1 || cnt == (size_t)-2)
 		break;
 
 	    /*
 	     * Careful: converting a wide NUL returns zero, but we
 	     * want to treat NULs as regular characters.
-	     * The NUL does get converted, however, so test that.
 	     * Assume it was represented by a single ASCII NUL;
 	     * certainly true for Unicode and unlikely to be false
 	     * in any non-pathological multibyte representation.
 	     */
-	    if (*outptr == L'\0' && ret == 0)
-		ret = 1;
+	    if (cnt == 0)
+		cnt = 1;
 
 	    if (outcs) {
 		int offs = inptr - instr;
-		if (offs <= incs && incs < offs + (int)ret)
+		if (offs <= incs && incs < offs + (int)cnt)
 		    *outcs = outptr - outstr;
 	    }
 
-	    inptr += ret;
+	    inptr += cnt;
 	    outptr++;
-	    ll -= ret;
+	    ll -= cnt;
 	}
 	if (outcs && inptr <= instr + incs)
 	    *outcs = outptr - outstr;