1/*
2 * Copyright 2010-2011, Oliver Tappe, zooey@hirschkaefer.de
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
5
6#include <wchar_private.h>
7
8
9int
10__wcswidth(const wchar_t* wcstring, size_t n)
11{
12	int width = 0;
13
14	while (*wcstring && n-- > 0) {
15		int w = wcwidth(*wcstring++);
16		if (w < 0)
17			return -1;
18
19		width += w;
20	}
21
22	return width;
23}
24
25
26B_DEFINE_WEAK_ALIAS(__wcswidth, wcswidth);
27