summaryrefslogtreecommitdiffhomepage
path: root/src/u16_wcsstr.c
blob: a1a416e8049c8d16d4ead396f674d0ce75875ad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*******************************************************************/
/*  u16ports: u16 variants of wide character string functions.     */
/*  Copyright (C) 2017  SysDeer Technologies, LLC                  */
/*  Released under the Standard MIT License; see COPYING.U16PORTS. */
/*******************************************************************/

#include <stdint.h>
#include <u16ports/u16ports.h>

uint16_t * u16_wcsstr(const uint16_t * wstr, const uint16_t * wsub)
{
	size_t len;

	if (!(len = u16_wcslen(wsub)))
		return (uint16_t *)wstr;

	for (; *wstr; wstr++)
		if (!(u16_wcsncmp(wstr,wsub,len)))
			return (uint16_t *)wstr;

	return 0;
}