Move rpmte-specific problem creation to a helper function
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 12 Mar 2010 09:44:47 +0000 (11:44 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 12 Mar 2010 09:44:47 +0000 (11:44 +0200)
lib/rpmte.c
lib/rpmte_internal.h

index 9764c7c..2fcb5b1 100644 (file)
@@ -197,12 +197,8 @@ static void buildRelocs(rpmte p, Header h, rpmRelocation *relocs)
            }
 
            if (!valid) {
-               if (p->probs == NULL) {
-                   p->probs = rpmpsCreate();
-               }
-               rpmpsAppend(p->probs, RPMPROB_BADRELOCATE,
-                       rpmteNEVRA(p), rpmteKey(p),
-                       p->relocs[i].oldPath, NULL, NULL, 0);
+               rpmteAddProblem(p, RPMPROB_BADRELOCATE,
+                               p->relocs[i].oldPath, NULL, NULL, 0);
            }
        } else {
            p->relocs[i].newPath = NULL;
@@ -722,6 +718,18 @@ rpmps rpmteProblems(rpmte te)
     return te ? te->probs : NULL;
 }
 
+void rpmteAddProblem(rpmte te, rpmProblemType type,
+                    const char *dn, const char *bn,
+                    const char *altNEVR, uint64_t number)
+{
+    if (te != NULL) {
+       if (te->probs == NULL)
+           te->probs = rpmpsCreate();
+       rpmpsAppend(te->probs, type, rpmteNEVRA(te), rpmteKey(te),
+                   dn, bn, altNEVR, number);
+    }
+}
+
 const char * rpmteTypeString(rpmte te)
 {
     switch(rpmteType(te)) {
index edf9a9f..3dadcdf 100644 (file)
@@ -35,6 +35,11 @@ RPM_GNUC_INTERNAL
 rpmps rpmteProblems(rpmte te);
 
 RPM_GNUC_INTERNAL
+void rpmteAddProblem(rpmte te, rpmProblemType type,
+                     const char *dn, const char *bn,
+                     const char *altNEVR, uint64_t number);
+
+RPM_GNUC_INTERNAL
 const char * rpmteTypeString(rpmte te);
 
 RPM_GNUC_INTERNAL