Blame src/u16_wcscspn.c

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