comparison mercurial/pathencode.c @ 17699:0696b1793f4b

pathencode: change isset name to avoid name collision On old Mac OS X versions (10.4), arpa/inet.h (included in mercurial/util.h) includes system/param.h which defines isset macro.
author André Sintzoff <andre.sintzoff@gmail.com>
date Sun, 30 Sep 2012 15:31:27 +0200
parents fb458b3e72fc
children 0459c6555f69
comparison
equal deleted inserted replaced
17694:fa714f3ed298 17699:0696b1793f4b
53 DH, 53 DH,
54 DHGDI, 54 DHGDI,
55 DDEFAULT, 55 DDEFAULT,
56 }; 56 };
57 57
58 static inline int isset(const uint32_t bitset[], char c) 58 static inline int inset(const uint32_t bitset[], char c)
59 { 59 {
60 return bitset[((uint8_t)c) >> 5] & (1 << (((uint8_t)c) & 31)); 60 return bitset[((uint8_t)c) >> 5] & (1 << (((uint8_t)c) & 31));
61 } 61 }
62 62
63 static inline void charcopy(char *dest, Py_ssize_t *destlen, size_t destsize, 63 static inline void charcopy(char *dest, Py_ssize_t *destlen, size_t destsize,
417 charcopy(dest, &destlen, destsize, ' '); 417 charcopy(dest, &destlen, destsize, ' ');
418 break; 418 break;
419 } 419 }
420 break; 420 break;
421 case DEFAULT: 421 case DEFAULT:
422 while (isset(onebyte, src[i])) { 422 while (inset(onebyte, src[i])) {
423 charcopy(dest, &destlen, destsize, src[i++]); 423 charcopy(dest, &destlen, destsize, src[i++]);
424 if (i == len) 424 if (i == len)
425 goto done; 425 goto done;
426 } 426 }
427 switch (src[i]) { 427 switch (src[i]) {
437 state = START; 437 state = START;
438 charcopy(dest, &destlen, destsize, '/'); 438 charcopy(dest, &destlen, destsize, '/');
439 i++; 439 i++;
440 break; 440 break;
441 default: 441 default:
442 if (isset(onebyte, src[i])) { 442 if (inset(onebyte, src[i])) {
443 do { 443 do {
444 charcopy(dest, &destlen, 444 charcopy(dest, &destlen,
445 destsize, src[i++]); 445 destsize, src[i++]);
446 } while (i < len && 446 } while (i < len &&
447 isset(onebyte, src[i])); 447 inset(onebyte, src[i]));
448 } 448 }
449 else if (isset(twobytes, src[i])) { 449 else if (inset(twobytes, src[i])) {
450 char c = src[i++]; 450 char c = src[i++];
451 charcopy(dest, &destlen, destsize, '_'); 451 charcopy(dest, &destlen, destsize, '_');
452 charcopy(dest, &destlen, destsize, 452 charcopy(dest, &destlen, destsize,
453 c == '_' ? '_' : c + 32); 453 c == '_' ? '_' : c + 32);
454 } 454 }