Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 37086:3b7b295cca90 legacy-trunk
Use macro versions instead of function versions when we already know the type.
This will hopefully get rid of some Coverity warnings, be a hint to
developers, and be marginally faster.
Some asserts were added when the type is currently known, but depends
on values from another function.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Mon, 20 Mar 2006 01:53:23 +0000 |
| parents | bfb74a420ac8 |
| children | 515118c0e338 |
line wrap: on
line diff
--- a/Objects/stringobject.c Sun Mar 19 20:40:05 2006 +0000 +++ b/Objects/stringobject.c Mon Mar 20 01:53:23 2006 +0000 @@ -569,8 +569,9 @@ if (!w) goto failed; /* Append bytes to output buffer. */ - r = PyString_AsString(w); - rn = PyString_Size(w); + assert(PyString_Check(w)); + r = PyString_AS_STRING(w); + rn = PyString_GET_SIZE(w); memcpy(p, r, rn); p += rn; Py_DECREF(w); @@ -2314,12 +2315,12 @@ } table = table1; - inlen = PyString_Size(input_obj); + inlen = PyString_GET_SIZE(input_obj); result = PyString_FromStringAndSize((char *)NULL, inlen); if (result == NULL) return NULL; output_start = output = PyString_AsString(result); - input = PyString_AsString(input_obj); + input = PyString_AS_STRING(input_obj); if (dellen == 0) { /* If no deletions are required, use faster code */
