comparison mercurial/dirs.c @ 30104:63e1dca2d6a4

dirs: inline string macros The old code happened to work because of how the macro was defined. This no longer works in Python 3. Furthermore, assigning to a macro just feels weird. So just inline the macro.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 08 Oct 2016 16:02:51 +0200
parents fe3a72a3e7ca
children b2f90d8878ac
comparison
equal deleted inserted replaced
30103:74cd33c9be76 30104:63e1dca2d6a4
59 key = PyString_FromStringAndSize(cpath, 59 key = PyString_FromStringAndSize(cpath,
60 pos < 2 ? 2 : pos); 60 pos < 2 ? 2 : pos);
61 if (key == NULL) 61 if (key == NULL)
62 goto bail; 62 goto bail;
63 } 63 }
64 PyString_GET_SIZE(key) = pos; 64 Py_SIZE(key) = pos;
65 PyString_AS_STRING(key)[pos] = '\0'; 65 ((PyStringObject *)key)->ob_sval[pos] = '\0';
66 66
67 val = PyDict_GetItem(dirs, key); 67 val = PyDict_GetItem(dirs, key);
68 if (val != NULL) { 68 if (val != NULL) {
69 PyInt_AS_LONG(val) += 1; 69 PyInt_AS_LONG(val) += 1;
70 break; 70 break;