|
|
d3eab7 |
/*******************************************************************/
|
|
|
d3eab7 |
/* u16ports: u16 variants of wide character string functions. */
|
|
|
d3eab7 |
/* Copyright (C) 2017 Z. Gilboa */
|
|
|
d3eab7 |
/* Released under the Standard MIT License; see COPYING.U16PORTS. */
|
|
|
d3eab7 |
/*******************************************************************/
|
|
|
d3eab7 |
|
|
|
d3eab7 |
#include <stdint.h>
|
|
|
d3eab7 |
#include <u16ports/u16ports.h>
|
|
|
d3eab7 |
|
|
|
d3eab7 |
size_t u16_wcsnlen(const uint16_t * src, size_t len)
|
|
|
d3eab7 |
{
|
|
|
d3eab7 |
const uint16_t * wch = src;
|
|
|
d3eab7 |
const uint16_t * cap = &src[len];
|
|
|
d3eab7 |
|
|
|
d3eab7 |
for (; (wch < cap) && *wch; )
|
|
|
d3eab7 |
wch++;
|
|
|
d3eab7 |
|
|
|
d3eab7 |
return wch - src;
|
|
|
d3eab7 |
}
|