File: stralloc_diffs.c

package info (click to toggle)
libowfat 0.28-6
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 4,068 kB
  • sloc: ansic: 12,863; makefile: 16
file content (14 lines) | stat: -rw-r--r-- 329 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "stralloc.h"
#include "byte.h"
#include "str.h"

extern int stralloc_diffs(const stralloc* a,const char* b) {
  register size_t i;
  register int j;
  for (i=0;;++i) {
    if (i==a->len) return (!b[i])?0:-1; if (!b[i]) return 1;
    if ((j=((unsigned char)(a->s[i])-(unsigned char)(b[i])))) return j;
  }
  return j;
}