浏览代码

minor optimization to mbstowcs

there is no need to zero-fill an mbstate_t object in the caller;
mbsrtowcs will automatically treat a null pointer as the initial
state.
Rich Felker 12 年之前
父节点
当前提交
f62b12d051
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      src/multibyte/mbstowcs.c

+ 1 - 2
src/multibyte/mbstowcs.c

@@ -13,6 +13,5 @@
 
 size_t mbstowcs(wchar_t *restrict ws, const char *restrict s, size_t wn)
 {
-	mbstate_t st = { 0 };
-	return mbsrtowcs(ws, (void*)&s, wn, &st);
+	return mbsrtowcs(ws, (void*)&s, wn, 0);
 }