From 464c0f9ae4af8346cd494c6434f4addabdd76e9d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 11 Sep 2012 17:22:52 +0200 Subject: [PATCH 19/89] maint: remove unnecessary wcslen use * parted/strlist.c (gettext_to_wchar): Tighten up test for mbsrtowcs failure and remove unnecessary wcslen use. --- parted/strlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parted/strlist.c b/parted/strlist.c index d34fb56..1f90c0e 100644 --- a/parted/strlist.c +++ b/parted/strlist.c @@ -112,10 +112,10 @@ gettext_to_wchar (const char* str) memset(&ps, 0, sizeof (ps)); status = mbsrtowcs(result, &str, count, &ps); - if (status == (size_t) -1) + if (str != NULL) goto error; - result = xrealloc (result, (wcslen (result) + 1) * sizeof (wchar_t)); + result = xrealloc (result, (status + 1) * sizeof (wchar_t)); return result; error: -- 1.8.5.3