Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/cmd/unix/drawterm/libc/utfnlen.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
 
4
int
5
utfnlen(char *s, long m)
6
{
7
	int c;
8
	long n;
9
	Rune rune;
10
	char *es;
11
 
12
	es = s + m;
13
	for(n = 0; s < es; n++) {
14
		c = *(uchar*)s;
15
		if(c < Runeself){
16
			if(c == '\0')
17
				break;
18
			s++;
19
			continue;
20
		}
21
		if(!fullrune(s, es-s))
22
			break;
23
		s += chartorune(&rune, s);
24
	}
25
	return n;
26
}