Avoid stepping on toes of relatives, part 2

- Eliminate uses of "class" which is a reserved keyword in C++
This commit is contained in:
Panu Matilainen 2010-09-21 15:02:43 +03:00
parent b9cd5a5e74
commit 7e53dc6ee1
5 changed files with 26 additions and 26 deletions

View File

@ -1153,9 +1153,9 @@ static void defaultMachine(const char ** arch,
# if defined(__linux__) && defined(__i386__)
{
char class = (char) (RPMClass() | '0');
char mclass = (char) (RPMClass() | '0');
if ((class == '6' && is_athlon()) || class == '7')
if ((mclass == '6' && is_athlon()) || mclass == '7')
strcpy(un.machine, "athlon");
else if (is_pentium4())
strcpy(un.machine, "pentium4");
@ -1163,8 +1163,8 @@ static void defaultMachine(const char ** arch,
strcpy(un.machine, "pentium3");
else if (is_geode())
strcpy(un.machine, "geode");
else if (strchr("3456", un.machine[1]) && un.machine[1] != class)
un.machine[1] = class;
else if (strchr("3456", un.machine[1]) && un.machine[1] != mclass)
un.machine[1] = mclass;
}
# endif

View File

@ -265,29 +265,29 @@ rpmTagReturnType rpmTagGetReturnType(rpmTag tag)
rpmTagClass rpmTagTypeGetClass(rpmTagType type)
{
rpmTagClass class;
rpmTagClass tclass;
switch (type & RPM_MASK_TYPE) {
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
case RPM_INT16_TYPE:
case RPM_INT32_TYPE:
case RPM_INT64_TYPE:
class = RPM_NUMERIC_CLASS;
tclass = RPM_NUMERIC_CLASS;
break;
case RPM_STRING_TYPE:
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
class = RPM_STRING_CLASS;
tclass = RPM_STRING_CLASS;
break;
case RPM_BIN_TYPE:
class = RPM_BINARY_CLASS;
tclass = RPM_BINARY_CLASS;
break;
case RPM_NULL_TYPE:
default:
class = RPM_NULL_CLASS;
tclass = RPM_NULL_CLASS;
break;
}
return class;
return tclass;
}
rpmTagClass rpmTagGetClass(rpmTag tag)

View File

@ -464,11 +464,11 @@ static PyObject * hdrGetTag(Header h, rpmTag tag)
return res;
}
static int validItem(rpmTagClass class, PyObject *item)
static int validItem(rpmTagClass tclass, PyObject *item)
{
int rc;
switch (class) {
switch (tclass) {
case RPM_NUMERIC_CLASS:
rc = (PyLong_Check(item) || PyInt_Check(item));
break;
@ -487,17 +487,17 @@ static int validItem(rpmTagClass class, PyObject *item)
static int validData(rpmTag tag, rpmTagType type, rpmTagReturnType retype, PyObject *value)
{
rpmTagClass class = rpmTagGetClass(tag);
rpmTagClass tclass = rpmTagGetClass(tag);
int valid = 1;
if (retype == RPM_SCALAR_RETURN_TYPE) {
valid = validItem(class, value);
valid = validItem(tclass, value);
} else if (retype == RPM_ARRAY_RETURN_TYPE && PyList_Check(value)) {
/* python lists can contain arbitrary objects, validate each item */
Py_ssize_t len = PyList_Size(value);
for (Py_ssize_t i = 0; i < len; i++) {
PyObject *item = PyList_GetItem(value, i);
if (!validItem(class, item)) {
if (!validItem(tclass, item)) {
valid = 0;
break;
}

View File

@ -11,11 +11,11 @@
/*
* Convert single tag data item to python object of suitable type
*/
static PyObject * rpmtd_ItemAsPyobj(rpmtd td, rpmTagClass class)
static PyObject * rpmtd_ItemAsPyobj(rpmtd td, rpmTagClass tclass)
{
PyObject *res = NULL;
switch (class) {
switch (tclass) {
case RPM_STRING_CLASS:
res = PyBytes_FromString(rpmtdGetString(td));
break;
@ -36,7 +36,7 @@ PyObject *rpmtd_AsPyobj(rpmtd td)
{
PyObject *res = NULL;
int array = (rpmTagGetReturnType(td->tag) == RPM_ARRAY_RETURN_TYPE);
rpmTagClass class = rpmtdClass(td);
rpmTagClass tclass = rpmtdClass(td);
if (!array && rpmtdCount(td) < 1) {
Py_RETURN_NONE;
@ -45,12 +45,12 @@ PyObject *rpmtd_AsPyobj(rpmtd td)
if (array) {
res = PyList_New(0);
while (rpmtdNext(td) >= 0) {
PyObject *item = rpmtd_ItemAsPyobj(td, class);
PyObject *item = rpmtd_ItemAsPyobj(td, tclass);
PyList_Append(res, item);
Py_DECREF(item);
}
} else {
res = rpmtd_ItemAsPyobj(td, class);
res = rpmtd_ItemAsPyobj(td, tclass);
}
return res;
}

View File

@ -985,7 +985,7 @@ char*
findClassName (FILE *fileHandle, symbolTable_t *symbolTable) {
char ignore[10];
unsigned short type = 0;
unsigned short class = 0;
unsigned short jclass = 0;
char *className;
/* seek a little past the end of the table */
@ -996,13 +996,13 @@ findClassName (FILE *fileHandle, symbolTable_t *symbolTable) {
my_fread(&type, 2, 1, fileHandle);
type=ntohs(type);
class = symbolTable->classRef[type];
if( !class ||
!symbolTable->stringList[class] ) {
die("Couln't find class: %d, provided by file.\n", class);
jclass = symbolTable->classRef[type];
if( !jclass ||
!symbolTable->stringList[jclass] ) {
die("Couln't find class: %d, provided by file.\n", jclass);
}
className=symbolTable->stringList[class];
className=symbolTable->stringList[jclass];
return className;