1 /*
2  *  Routines to access hardware
3  *
4  *  Copyright (c) 2013 Realtek Semiconductor Corp.
5  *
6  *  This module is a confidential and proprietary property of RealTek and
7  *  possession or use of this module requires written permission of RealTek.
8  */
9 
10 #include "basic_types.h"
11 #include <stdarg.h>
12 #include <stddef.h>             /* Compiler defns such as size_t, NULL etc. */
13 #include "strproc.h"
14 #include "section_config.h"
15 #include "diag.h"
16 #include "ameba_soc.h"
17 
18 LIBC_ROM_TEXT_SECTION
_strnlen(const char * s,size_t count)19 _LONG_CALL_ size_t _strnlen(const char *s, size_t count)
20 {
21     const char *sc;
22 
23     for (sc = s; count-- && *sc != '\0'; ++sc)
24         ;
25 
26     return sc - s;
27 }
28