equal
deleted
inserted
replaced
45 if (!l) |
45 if (!l) |
46 return -1; |
46 return -1; |
47 |
47 |
48 /* build the line array and calculate hashes */ |
48 /* build the line array and calculate hashes */ |
49 hash = 0; |
49 hash = 0; |
50 for (p = a; p < a + len; p++) { |
50 for (p = a; p < plast; p++) { |
51 hash = HASH(hash, *p); |
51 hash = HASH(hash, *p); |
52 |
52 |
53 if (*p == '\n' || p == plast) { |
53 if (*p == '\n') { |
54 l->hash = hash; |
54 l->hash = hash; |
55 hash = 0; |
55 hash = 0; |
56 l->len = p - b + 1; |
56 l->len = p - b + 1; |
57 l->l = b; |
57 l->l = b; |
58 l->n = INT_MAX; |
58 l->n = INT_MAX; |
59 l++; |
59 l++; |
60 b = p + 1; |
60 b = p + 1; |
61 } |
61 } |
|
62 } |
|
63 |
|
64 if (p == plast) { |
|
65 hash = HASH(hash, *p); |
|
66 l->hash = hash; |
|
67 l->len = p - b + 1; |
|
68 l->l = b; |
|
69 l->n = INT_MAX; |
|
70 l++; |
62 } |
71 } |
63 |
72 |
64 /* set up a sentinel */ |
73 /* set up a sentinel */ |
65 l->hash = 0; |
74 l->hash = 0; |
66 l->len = 0; |
75 l->len = 0; |