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:
Neal Norwitz 2006-03-20 01:53:23 +00:00
parent 70f05c5d7f
commit 2aa9a5dfdd
7 changed files with 19 additions and 16 deletions

View file

@ -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;
}