Blame src/u16_wcsspn.c

64c52b
/*******************************************************************/
64c52b
/*  u16ports: u16 variants of wide character string functions.     */
64c52b
/*  Copyright (C) 2017  Z. Gilboa                                  */
64c52b
/*  Released under the Standard MIT License; see COPYING.U16PORTS. */
64c52b
/*******************************************************************/
64c52b
64c52b
#include <stdint.h>
64c52b
#include <u16ports/u16ports.h>
64c52b
64c52b
size_t u16_wcsspn(const uint16_t * wstr, const uint16_t * cstr)
64c52b
{
64c52b
	const uint16_t * wch;
64c52b
	const uint16_t * wcs;
64c52b
64c52b
        for (wcs=wstr; *wcs; wcs++)
64c52b
		for (wch=cstr; *wch!=*wcs; wch++)
64c52b
			if (!*wch)
64c52b
				return wcs - wstr;
64c52b
64c52b
64c52b
        return wcs - wstr;
64c52b
}