libowfat/stralloc/stralloc_diff.c

16 lines
345 B
C
Raw Normal View History

2002-10-28 20:15:03 +00:00
#include "stralloc.h"
#include "byte.h"
#include "str.h"
extern int stralloc_diff(const stralloc* a,const stralloc* b) {
2007-10-17 16:23:01 +00:00
register size_t i;
2002-10-28 20:15:03 +00:00
register int j;
for (i=0;;++i) {
2016-04-27 14:07:49 +00:00
if (i==a->len) return i==b->len?0:-1;
if (i==b->len) return 1;
if ((j=((unsigned char)(a->s[i])-(unsigned char)(b->s[i])))) return j;
2002-10-28 20:15:03 +00:00
}
return j;
}