Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7756 → Rev 7757

/programs/cmm/lib/strings.h
115,6 → 115,30
}
 
/*
signed int strncmp(dword s1, s2, signed n)
unsigned char _s1,_s2;
{
if (n == 0)
return 0;
do {
_s1 = DSBYTE[s1];
_s2 = DSBYTE[s2];
if (_s1 != _s2)
{
$dec s2
return _s1 - _s2;
}
$inc s2
if (_s1 == 0)
break;
$inc s1
$dec n
} while (n);
return 0;
}
*/
 
/*
inline signed int strncmp(dword text1,text2,len)
{
134,7 → 158,7
EAX-=2+ECX;
}
 
inline strnlen(dword str, dword maxlen)
inline dword strnlen(dword str, dword maxlen)
{
dword cp;
for (cp = str; (maxlen != 0) && (DSBYTE[cp] != '\0'); cp++, maxlen--);
181,20 → 205,7
return 0;
}
 
/*
TODO: rewrite streq() using pure assembliy
 
inline fastcall void strcpy( EDI, ESI)
{
$cld
L2:
$lodsb
$stosb
$test al,al
$jnz L2
}
*/
 
inline fastcall streq(ESI, EDI)
{
loop()
212,31 → 223,6
return true;
}
 
/*
signed int strncmp(dword s1, s2, signed n)
unsigned char _s1,_s2;
{
if (n == 0)
return 0;
do {
_s1 = DSBYTE[s1];
_s2 = DSBYTE[s2];
if (_s1 != _s2)
{
$dec s2
return _s1 - _s2;
}
$inc s2
if (_s1 == 0)
break;
$inc s1
$dec n
} while (n);
return 0;
}
*/
 
 
inline fastcall void strcpy( EDI, ESI)
{
$cld
395,13 → 381,13
}
}
 
:void strncat(dword dst, src, dword len)
:void strncat(dword dst, src, len)
{
while (ESBYTE[dst]) && (len) {
dst++;
len--;
}
while (ESBYTE[src]) && (len) {
while (ESBYTE[src]) && (len>1) {
ESBYTE[dst] = ESBYTE[src];
dst++;
src++;
410,6 → 396,18
ESBYTE[dst] = 0;
}
 
:void chrncat(dword dst, unsigned char s, dword len)
{
while (ESBYTE[dst]) && (len) {
dst++;
len--;
}
if (len>1) {
ESBYTE[dst] = s;
ESBYTE[dst+1] = 0;
}
}
 
inline fastcall void chrcat(ESI, DI)
{
while (ESBYTE[ESI]) ESI++;