linecmp.c (304B)
1 /* See LICENSE file for copyright and license details. */ 2 #include <stdio.h> 3 #include <string.h> 4 5 #include "../text.h" 6 #include "../util.h" 7 8 int 9 linecmp(struct line *a, struct line *b) 10 { 11 int res = 0; 12 13 if (!(res = memcmp(a->data, b->data, MIN(a->len, b->len)))) 14 res = a->len - b->len; 15 16 return res; 17 }