mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
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.
This commit is contained in:
parent
70f05c5d7f
commit
2aa9a5dfdd
7 changed files with 19 additions and 16 deletions
|
|
@ -388,15 +388,15 @@ class_str(PyClassObject *op)
|
|||
Py_INCREF(name);
|
||||
return name;
|
||||
}
|
||||
m = PyString_Size(mod);
|
||||
n = PyString_Size(name);
|
||||
m = PyString_GET_SIZE(mod);
|
||||
n = PyString_GET_SIZE(name);
|
||||
res = PyString_FromStringAndSize((char *)NULL, m+1+n);
|
||||
if (res != NULL) {
|
||||
char *s = PyString_AsString(res);
|
||||
memcpy(s, PyString_AsString(mod), m);
|
||||
char *s = PyString_AS_STRING(res);
|
||||
memcpy(s, PyString_AS_STRING(mod), m);
|
||||
s += m;
|
||||
*s++ = '.';
|
||||
memcpy(s, PyString_AsString(name), n);
|
||||
memcpy(s, PyString_AS_STRING(name), n);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue