Show More
@@ -38,7 +38,7 b' static PyObject *b85encode(PyObject *sel' | |||||
38 | unsigned int acc, val, ch; |
|
38 | unsigned int acc, val, ch; | |
39 | int pad = 0; |
|
39 | int pad = 0; | |
40 |
|
40 | |||
41 |
if (!PyArg_ParseTuple(args, |
|
41 | if (!PyArg_ParseTuple(args, "y#|i", &text, &len, &pad)) { | |
42 | return NULL; |
|
42 | return NULL; | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
@@ -90,7 +90,7 b' static PyObject *b85decode(PyObject *sel' | |||||
90 | int c; |
|
90 | int c; | |
91 | unsigned int acc; |
|
91 | unsigned int acc; | |
92 |
|
92 | |||
93 |
if (!PyArg_ParseTuple(args, |
|
93 | if (!PyArg_ParseTuple(args, "y#", &text, &len)) { | |
94 | return NULL; |
|
94 | return NULL; | |
95 | } |
|
95 | } | |
96 |
|
96 |
@@ -76,8 +76,7 b' static PyObject *bdiff(PyObject *self, P' | |||||
76 |
|
76 | |||
77 | l.next = NULL; |
|
77 | l.next = NULL; | |
78 |
|
78 | |||
79 |
if (!PyArg_ParseTuple(args, |
|
79 | if (!PyArg_ParseTuple(args, "y*y*:bdiff", &ba, &bb)) { | |
80 | &bb)) { |
|
|||
81 | return NULL; |
|
80 | return NULL; | |
82 | } |
|
81 | } | |
83 |
|
82 | |||
@@ -233,7 +232,7 b' static PyObject *splitnewlines(PyObject ' | |||||
233 | Py_ssize_t nelts = 0, size, i, start = 0; |
|
232 | Py_ssize_t nelts = 0, size, i, start = 0; | |
234 | PyObject *result = NULL; |
|
233 | PyObject *result = NULL; | |
235 |
|
234 | |||
236 |
if (!PyArg_ParseTuple(args, |
|
235 | if (!PyArg_ParseTuple(args, "y#", &text, &size)) { | |
237 | goto abort; |
|
236 | goto abort; | |
238 | } |
|
237 | } | |
239 | if (!size) { |
|
238 | if (!size) { | |
@@ -299,8 +298,7 b' static PyObject *xdiffblocks(PyObject *s' | |||||
299 | NULL, /* priv */ |
|
298 | NULL, /* priv */ | |
300 | }; |
|
299 | }; | |
301 |
|
300 | |||
302 |
if (!PyArg_ParseTuple(args, |
|
301 | if (!PyArg_ParseTuple(args, "y#y#", &a.ptr, &la, &b.ptr, &lb)) { | |
303 | &lb)) { |
|
|||
304 | return NULL; |
|
302 | return NULL; | |
305 | } |
|
303 | } | |
306 |
|
304 |
@@ -125,8 +125,7 b' PyObject *isasciistr(PyObject *self, PyO' | |||||
125 | { |
|
125 | { | |
126 | const char *buf; |
|
126 | const char *buf; | |
127 | Py_ssize_t i, len; |
|
127 | Py_ssize_t i, len; | |
128 |
if (!PyArg_ParseTuple(args, |
|
128 | if (!PyArg_ParseTuple(args, "y#:isasciistr", &buf, &len)) { | |
129 | &buf, &len)) { |
|
|||
130 | return NULL; |
|
129 | return NULL; | |
131 | } |
|
130 | } | |
132 | i = 0; |
|
131 | i = 0; |
@@ -780,7 +780,7 b' static lazymanifest *lazymanifest_filter' | |||||
780 | Py_INCREF(copy->pydata); |
|
780 | Py_INCREF(copy->pydata); | |
781 | for (i = 0; i < self->numlines; i++) { |
|
781 | for (i = 0; i < self->numlines; i++) { | |
782 | PyObject *arglist = NULL, *result = NULL; |
|
782 | PyObject *arglist = NULL, *result = NULL; | |
783 |
arglist = Py_BuildValue( |
|
783 | arglist = Py_BuildValue("(y)", | |
784 | self->lines[i].start); |
|
784 | self->lines[i].start); | |
785 | if (!arglist) { |
|
785 | if (!arglist) { | |
786 | goto bail; |
|
786 | goto bail; |
@@ -144,8 +144,7 b' static PyObject *patchedsize(PyObject *s' | |||||
144 | Py_ssize_t patchlen; |
|
144 | Py_ssize_t patchlen; | |
145 | char *bin; |
|
145 | char *bin; | |
146 |
|
146 | |||
147 |
if (!PyArg_ParseTuple(args, |
|
147 | if (!PyArg_ParseTuple(args, "ly#", &orig, &bin, &patchlen)) { | |
148 | &patchlen)) { |
|
|||
149 | return NULL; |
|
148 | return NULL; | |
150 | } |
|
149 | } | |
151 |
|
150 |
@@ -198,7 +198,7 b' static PyObject *make_item(const WIN32_F' | |||||
198 | ? _S_IFDIR : _S_IFREG; |
|
198 | ? _S_IFDIR : _S_IFREG; | |
199 |
|
199 | |||
200 | if (!wantstat) |
|
200 | if (!wantstat) | |
201 |
return Py_BuildValue( |
|
201 | return Py_BuildValue("yi", fd->cFileName, kind); | |
202 |
|
202 | |||
203 | py_st = PyObject_CallObject((PyObject *)&listdir_stat_type, NULL); |
|
203 | py_st = PyObject_CallObject((PyObject *)&listdir_stat_type, NULL); | |
204 | if (!py_st) |
|
204 | if (!py_st) | |
@@ -216,7 +216,7 b' static PyObject *make_item(const WIN32_F' | |||||
216 | if (kind == _S_IFREG) |
|
216 | if (kind == _S_IFREG) | |
217 | stp->st_size = ((__int64)fd->nFileSizeHigh << 32) |
|
217 | stp->st_size = ((__int64)fd->nFileSizeHigh << 32) | |
218 | + fd->nFileSizeLow; |
|
218 | + fd->nFileSizeLow; | |
219 |
return Py_BuildValue( |
|
219 | return Py_BuildValue("yiN", fd->cFileName, | |
220 | kind, py_st); |
|
220 | kind, py_st); | |
221 | } |
|
221 | } | |
222 |
|
222 | |||
@@ -404,10 +404,10 b' static PyObject *_listdir_stat(char *pat' | |||||
404 | PyObject *stat = makestat(&st); |
|
404 | PyObject *stat = makestat(&st); | |
405 | if (!stat) |
|
405 | if (!stat) | |
406 | goto error; |
|
406 | goto error; | |
407 |
elem = Py_BuildValue( |
|
407 | elem = Py_BuildValue("yiN", ent->d_name, | |
408 | kind, stat); |
|
408 | kind, stat); | |
409 | } else |
|
409 | } else | |
410 |
elem = Py_BuildValue( |
|
410 | elem = Py_BuildValue("yi", ent->d_name, | |
411 | kind); |
|
411 | kind); | |
412 | if (!elem) |
|
412 | if (!elem) | |
413 | goto error; |
|
413 | goto error; | |
@@ -585,10 +585,10 b' static PyObject *_listdir_batch(char *pa' | |||||
585 | stat = makestat(&st); |
|
585 | stat = makestat(&st); | |
586 | if (!stat) |
|
586 | if (!stat) | |
587 | goto error; |
|
587 | goto error; | |
588 |
elem = Py_BuildValue( |
|
588 | elem = Py_BuildValue("yiN", | |
589 | filename, kind, stat); |
|
589 | filename, kind, stat); | |
590 | } else |
|
590 | } else | |
591 |
elem = Py_BuildValue( |
|
591 | elem = Py_BuildValue("yi", | |
592 | filename, kind); |
|
592 | filename, kind); | |
593 | if (!elem) |
|
593 | if (!elem) | |
594 | goto error; |
|
594 | goto error; | |
@@ -772,7 +772,7 b' bail:' | |||||
772 | static PyObject *setprocname(PyObject *self, PyObject *args) |
|
772 | static PyObject *setprocname(PyObject *self, PyObject *args) | |
773 | { |
|
773 | { | |
774 | const char *name = NULL; |
|
774 | const char *name = NULL; | |
775 |
if (!PyArg_ParseTuple(args, |
|
775 | if (!PyArg_ParseTuple(args, "y", &name)) | |
776 | return NULL; |
|
776 | return NULL; | |
777 |
|
777 | |||
778 | #if defined(SETPROCNAME_USE_SETPROCTITLE) |
|
778 | #if defined(SETPROCNAME_USE_SETPROCTITLE) | |
@@ -1127,14 +1127,14 b' static PyObject *getfstype(PyObject *sel' | |||||
1127 | const char *path = NULL; |
|
1127 | const char *path = NULL; | |
1128 | struct statfs buf; |
|
1128 | struct statfs buf; | |
1129 | int r; |
|
1129 | int r; | |
1130 |
if (!PyArg_ParseTuple(args, |
|
1130 | if (!PyArg_ParseTuple(args, "y", &path)) | |
1131 | return NULL; |
|
1131 | return NULL; | |
1132 |
|
1132 | |||
1133 | memset(&buf, 0, sizeof(buf)); |
|
1133 | memset(&buf, 0, sizeof(buf)); | |
1134 | r = statfs(path, &buf); |
|
1134 | r = statfs(path, &buf); | |
1135 | if (r != 0) |
|
1135 | if (r != 0) | |
1136 | return PyErr_SetFromErrno(PyExc_OSError); |
|
1136 | return PyErr_SetFromErrno(PyExc_OSError); | |
1137 |
return Py_BuildValue( |
|
1137 | return Py_BuildValue("y", describefstype(&buf)); | |
1138 | } |
|
1138 | } | |
1139 | #endif /* defined(HAVE_LINUX_STATFS) || defined(HAVE_BSD_STATFS) */ |
|
1139 | #endif /* defined(HAVE_LINUX_STATFS) || defined(HAVE_BSD_STATFS) */ | |
1140 |
|
1140 | |||
@@ -1145,14 +1145,14 b' static PyObject *getfsmountpoint(PyObjec' | |||||
1145 | const char *path = NULL; |
|
1145 | const char *path = NULL; | |
1146 | struct statfs buf; |
|
1146 | struct statfs buf; | |
1147 | int r; |
|
1147 | int r; | |
1148 |
if (!PyArg_ParseTuple(args, |
|
1148 | if (!PyArg_ParseTuple(args, "y", &path)) | |
1149 | return NULL; |
|
1149 | return NULL; | |
1150 |
|
1150 | |||
1151 | memset(&buf, 0, sizeof(buf)); |
|
1151 | memset(&buf, 0, sizeof(buf)); | |
1152 | r = statfs(path, &buf); |
|
1152 | r = statfs(path, &buf); | |
1153 | if (r != 0) |
|
1153 | if (r != 0) | |
1154 | return PyErr_SetFromErrno(PyExc_OSError); |
|
1154 | return PyErr_SetFromErrno(PyExc_OSError); | |
1155 |
return Py_BuildValue( |
|
1155 | return Py_BuildValue("y", buf.f_mntonname); | |
1156 | } |
|
1156 | } | |
1157 | #endif /* defined(HAVE_BSD_STATFS) */ |
|
1157 | #endif /* defined(HAVE_BSD_STATFS) */ | |
1158 |
|
1158 | |||
@@ -1187,8 +1187,7 b' static PyObject *listdir(PyObject *self,' | |||||
1187 |
|
1187 | |||
1188 | static char *kwlist[] = {"path", "stat", "skip", NULL}; |
|
1188 | static char *kwlist[] = {"path", "stat", "skip", NULL}; | |
1189 |
|
1189 | |||
1190 |
if (!PyArg_ParseTupleAndKeywords(args, kwargs, |
|
1190 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y#|OO:listdir", | |
1191 | "y#|OO:listdir"), |
|
|||
1192 | kwlist, &path, &plen, &statobj, &skipobj)) |
|
1191 | kwlist, &path, &plen, &statobj, &skipobj)) | |
1193 | return NULL; |
|
1192 | return NULL; | |
1194 |
|
1193 | |||
@@ -1221,8 +1220,7 b' static PyObject *posixfile(PyObject *sel' | |||||
1221 | int plus; |
|
1220 | int plus; | |
1222 | FILE *fp; |
|
1221 | FILE *fp; | |
1223 |
|
1222 | |||
1224 |
if (!PyArg_ParseTupleAndKeywords(args, kwds, |
|
1223 | if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|yi:posixfile", | |
1225 | "et|yi:posixfile"), |
|
|||
1226 | kwlist, |
|
1224 | kwlist, | |
1227 | Py_FileSystemDefaultEncoding, |
|
1225 | Py_FileSystemDefaultEncoding, | |
1228 | &name, &mode, &bufsize)) |
|
1226 | &name, &mode, &bufsize)) |
@@ -813,9 +813,8 b' static PyObject *parse_dirstate(PyObject' | |||||
813 | Py_ssize_t len = 40; |
|
813 | Py_ssize_t len = 40; | |
814 | Py_ssize_t readlen; |
|
814 | Py_ssize_t readlen; | |
815 |
|
815 | |||
816 | if (!PyArg_ParseTuple( |
|
816 | if (!PyArg_ParseTuple(args, "O!O!y#:parse_dirstate", &PyDict_Type, | |
817 | args, PY23("O!O!s#:parse_dirstate", "O!O!y#:parse_dirstate"), |
|
817 | &dmap, &PyDict_Type, &cmap, &str, &readlen)) { | |
818 | &PyDict_Type, &dmap, &PyDict_Type, &cmap, &str, &readlen)) { |
|
|||
819 | goto quit; |
|
818 | goto quit; | |
820 | } |
|
819 | } | |
821 |
|
820 | |||
@@ -828,8 +827,8 b' static PyObject *parse_dirstate(PyObject' | |||||
828 | goto quit; |
|
827 | goto quit; | |
829 | } |
|
828 | } | |
830 |
|
829 | |||
831 |
parents = Py_BuildValue( |
|
830 | parents = Py_BuildValue("y#y#", str, (Py_ssize_t)20, str + 20, | |
832 |
|
|
831 | (Py_ssize_t)20); | |
833 | if (!parents) { |
|
832 | if (!parents) { | |
834 | goto quit; |
|
833 | goto quit; | |
835 | } |
|
834 | } | |
@@ -1158,8 +1157,7 b' static PyObject *fm1readmarkers(PyObject' | |||||
1158 | Py_ssize_t datalen, offset, stop; |
|
1157 | Py_ssize_t datalen, offset, stop; | |
1159 | PyObject *markers = NULL; |
|
1158 | PyObject *markers = NULL; | |
1160 |
|
1159 | |||
1161 |
if (!PyArg_ParseTuple(args, |
|
1160 | if (!PyArg_ParseTuple(args, "y#nn", &data, &datalen, &offset, &stop)) { | |
1162 | &offset, &stop)) { |
|
|||
1163 | return NULL; |
|
1161 | return NULL; | |
1164 | } |
|
1162 | } | |
1165 | if (offset < 0) { |
|
1163 | if (offset < 0) { |
@@ -535,8 +535,7 b' PyObject *lowerencode(PyObject *self, Py' | |||||
535 | Py_ssize_t len, newlen; |
|
535 | Py_ssize_t len, newlen; | |
536 | PyObject *ret; |
|
536 | PyObject *ret; | |
537 |
|
537 | |||
538 |
if (!PyArg_ParseTuple(args, |
|
538 | if (!PyArg_ParseTuple(args, "y#:lowerencode", &path, &len)) { | |
539 | &path, &len)) { |
|
|||
540 | return NULL; |
|
539 | return NULL; | |
541 | } |
|
540 | } | |
542 |
|
541 | |||
@@ -711,7 +710,7 b' static int sha1hash(char hash[20], const' | |||||
711 | } |
|
710 | } | |
712 | } |
|
711 | } | |
713 |
|
712 | |||
714 |
shaobj = PyObject_CallFunction(shafunc, |
|
713 | shaobj = PyObject_CallFunction(shafunc, "y#", str, len); | |
715 |
|
714 | |||
716 | if (shaobj == NULL) { |
|
715 | if (shaobj == NULL) { | |
717 | return -1; |
|
716 | return -1; |
@@ -109,11 +109,9 b' static Py_ssize_t inline_scan(indexObjec' | |||||
109 | static int index_find_node(indexObject *self, const char *node); |
|
109 | static int index_find_node(indexObject *self, const char *node); | |
110 |
|
110 | |||
111 | #if LONG_MAX == 0x7fffffffL |
|
111 | #if LONG_MAX == 0x7fffffffL | |
112 | static const char *const tuple_format = |
|
112 | static const char *const tuple_format = "Kiiiiiiy#KiBBi"; | |
113 | PY23("Kiiiiiis#KiBBi", "Kiiiiiiy#KiBBi"); |
|
|||
114 | #else |
|
113 | #else | |
115 | static const char *const tuple_format = |
|
114 | static const char *const tuple_format = "kiiiiiiy#kiBBi"; | |
116 | PY23("kiiiiiis#kiBBi", "kiiiiiiy#kiBBi"); |
|
|||
117 | #endif |
|
115 | #endif | |
118 |
|
116 | |||
119 | /* A RevlogNG v1 index entry is 64 bytes long. */ |
|
117 | /* A RevlogNG v1 index entry is 64 bytes long. */ | |
@@ -720,9 +718,9 b' static PyObject *index_replace_sidedata_' | |||||
720 | char comp_mode; |
|
718 | char comp_mode; | |
721 | char *data; |
|
719 | char *data; | |
722 | #if LONG_MAX == 0x7fffffffL |
|
720 | #if LONG_MAX == 0x7fffffffL | |
723 |
const char *const sidedata_format = |
|
721 | const char *const sidedata_format = "nKiKB"; | |
724 | #else |
|
722 | #else | |
725 |
const char *const sidedata_format = |
|
723 | const char *const sidedata_format = "nkikB"; | |
726 | #endif |
|
724 | #endif | |
727 |
|
725 | |||
728 | if (self->entry_size == v1_entry_size || self->inlined) { |
|
726 | if (self->entry_size == v1_entry_size || self->inlined) { | |
@@ -2301,7 +2299,7 b' static PyObject *index_partialmatch(inde' | |||||
2301 | char *node; |
|
2299 | char *node; | |
2302 | int rev, i; |
|
2300 | int rev, i; | |
2303 |
|
2301 | |||
2304 |
if (!PyArg_ParseTuple(args, |
|
2302 | if (!PyArg_ParseTuple(args, "y#", &node, &nodelen)) | |
2305 | return NULL; |
|
2303 | return NULL; | |
2306 |
|
2304 | |||
2307 | if (nodelen < 1) { |
|
2305 | if (nodelen < 1) { | |
@@ -3012,10 +3010,9 b' static int index_init(indexObject *self,' | |||||
3012 | self->entry_size = cl2_entry_size; |
|
3010 | self->entry_size = cl2_entry_size; | |
3013 | } |
|
3011 | } | |
3014 |
|
3012 | |||
3015 | self->nullentry = |
|
3013 | self->nullentry = Py_BuildValue( | |
3016 | Py_BuildValue(PY23("iiiiiiis#iiBBi", "iiiiiiiy#iiBBi"), 0, 0, 0, -1, |
|
3014 | "iiiiiiiy#iiBBi", 0, 0, 0, -1, -1, -1, -1, nullid, self->nodelen, 0, | |
3017 | -1, -1, -1, nullid, self->nodelen, 0, 0, |
|
3015 | 0, comp_mode_inline, comp_mode_inline, rank_unknown); | |
3018 | comp_mode_inline, comp_mode_inline, rank_unknown); |
|
|||
3019 |
|
3016 | |||
3020 | if (!self->nullentry) |
|
3017 | if (!self->nullentry) | |
3021 | return -1; |
|
3018 | return -1; |
@@ -14,13 +14,6 b'' | |||||
14 | #define IS_PY3K |
|
14 | #define IS_PY3K | |
15 | #endif |
|
15 | #endif | |
16 |
|
16 | |||
17 | /* helper to switch things like string literal depending on Python version */ |
|
|||
18 | #ifdef IS_PY3K |
|
|||
19 | #define PY23(py2, py3) py3 |
|
|||
20 | #else |
|
|||
21 | #define PY23(py2, py3) py2 |
|
|||
22 | #endif |
|
|||
23 |
|
||||
24 | /* clang-format off */ |
|
17 | /* clang-format off */ | |
25 | typedef struct { |
|
18 | typedef struct { | |
26 | PyObject_HEAD |
|
19 | PyObject_HEAD |
General Comments 0
You need to be logged in to leave comments.
Login now