1 Ruby 2.x #includes <math.h>, which declares a function named
2 remainder(). We must rename our variable to avoid name-conflict
3 and allow this code to compile with Ruby-2.x
7 --- ext/slide.c.orig 2006-09-17 17:45:51 UTC
9 @@ -87,7 +87,7 @@ static struct decode_option decode_set;
11 static unsigned int txtsiz;
12 static unsigned long dicsiz;
13 -static unsigned int remainder;
14 +static unsigned int iremainder;
18 @@ -162,7 +162,7 @@ update_dict(pos, crc)
20 n = fread_crc(crc, &text[txtsiz - dicsiz], dicsiz, infile);
26 for (i = 0; i < HSHSIZ; i++) {
27 @@ -270,7 +270,7 @@ search_dict(token, pos, min, m)
29 search_dict_1(token, pos, 0, off+2, m);
31 - if (m->len > remainder) m->len = remainder;
32 + if (m->len > iremainder) m->len = iremainder;
35 /* slide dictionary */
36 @@ -280,7 +280,7 @@ next_token(token, pos, crc)
42 if (++*pos >= txtsiz - maxmatch) {
43 update_dict(pos, crc);
45 @@ -316,17 +316,17 @@ encode(intf)
46 encode_set.encode_start();
47 memset(text, ' ', TXTSIZ);
49 - remainder = fread_crc(&crc, &text[dicsiz], txtsiz-dicsiz, infile);
50 + iremainder = fread_crc(&crc, &text[dicsiz], txtsiz-dicsiz, infile);
52 match.len = THRESHOLD - 1;
54 - if (match.len > remainder) match.len = remainder;
55 + if (match.len > iremainder) match.len = iremainder;
58 token = INIT_HASH(pos);
59 insert_hash(token, pos); /* associate token and pos */
61 - while (remainder > 0 && ! unpackable) {
62 + while (iremainder > 0 && ! unpackable) {
65 next_token(&token, &pos, &crc);