Use tagValue() for name->tag lookups instead of manually walking tagtable.
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 13 Jul 2007 11:23:21 +0000 (14:23 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 13 Jul 2007 11:23:21 +0000 (14:23 +0300)
python/header-py.c

index 709ecf2..dcfd98a 100644 (file)
@@ -377,15 +377,12 @@ static void hdr_dealloc(hdrObject * s)
 long tagNumFromPyObject (PyObject *item)
 {
     char * str;
-    int i;
 
     if (PyInt_Check(item)) {
        return PyInt_AsLong(item);
     } else if (PyString_Check(item)) {
        str = PyString_AsString(item);
-       for (i = 0; i < rpmTagTableSize; i++)
-           if (!xstrcasecmp(rpmTagTable[i].name + 7, str)) break;
-       if (i < rpmTagTableSize) return rpmTagTable[i].val;
+       return tagValue(str);
     }
     return -1;
 }