Blame src/u16_wcsstr.c

04b6fc
/*******************************************************************/
04b6fc
/*  u16ports: u16 variants of wide character string functions.     */
04b6fc
/*  Copyright (C) 2017  Z. Gilboa                                  */
04b6fc
/*  Released under the Standard MIT License; see COPYING.U16PORTS. */
04b6fc
/*******************************************************************/
04b6fc
04b6fc
#include <stdint.h>
04b6fc
#include <u16ports/u16ports.h>
04b6fc
04b6fc
uint16_t * u16_wcsstr(const uint16_t * wstr, const uint16_t * wsub)
04b6fc
{
04b6fc
	size_t len;
04b6fc
04b6fc
	if (!(len = u16_wcslen(wsub)))
04b6fc
		return (uint16_t *)wstr;
04b6fc
04b6fc
	for (; *wstr; wstr++)
04b6fc
		if (!(u16_wcsncmp(wstr,wsub,len)))
04b6fc
			return (uint16_t *)wstr;
04b6fc
04b6fc
	return 0;
04b6fc
}