rpmps.c | rpmps.c | |||
---|---|---|---|---|
skipping to change at line 16 | skipping to change at line 16 | |||
#include <rpmio.h> | #include <rpmio.h> | |||
#include <rpmiotypes.h> /* XXX fnpyKey */ | #include <rpmiotypes.h> /* XXX fnpyKey */ | |||
#include <rpmtypes.h> | #include <rpmtypes.h> | |||
#define _RPMPS_INTERNAL | #define _RPMPS_INTERNAL | |||
#include "rpmps.h" | #include "rpmps.h" | |||
#include "debug.h" | #include "debug.h" | |||
#ifdef __cplusplus | ||||
GENfree(rpmps) | ||||
GENfree(rpmpsi) | ||||
GENfree(rpmProblem) | ||||
#endif /* __cplusplus */ | ||||
/*@access fnpyKey @*/ | /*@access fnpyKey @*/ | |||
/*@access rpmProblem @*/ | /*@access rpmProblem @*/ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
int _rpmps_debug = 0; | int _rpmps_debug = 0; | |||
static void rpmpsFini(void * _ps) | static void rpmpsFini(void * _ps) | |||
{ | { | |||
rpmps ps = _ps; | rpmps ps = (rpmps) _ps; | |||
int i; | int i; | |||
if (ps == NULL) return; | if (ps == NULL) return; | |||
if (ps->probs) | if (ps->probs) | |||
for (i = 0; i < ps->numProblems; i++) { | for (i = 0; i < ps->numProblems; i++) { | |||
rpmProblem p = ps->probs + i; | rpmProblem p = ps->probs + i; | |||
p->pkgNEVR = _free(p->pkgNEVR); | p->pkgNEVR = _free(p->pkgNEVR); | |||
p->altNEVR = _free(p->altNEVR); | p->altNEVR = _free(p->altNEVR); | |||
p->str1 = _free(p->str1); | p->str1 = _free(p->str1); | |||
} | } | |||
skipping to change at line 76 | skipping to change at line 82 | |||
int numProblems = 0; | int numProblems = 0; | |||
if (ps && ps->probs) | if (ps && ps->probs) | |||
numProblems = ps->numProblems; | numProblems = ps->numProblems; | |||
return numProblems; | return numProblems; | |||
} | } | |||
rpmpsi rpmpsInitIterator(rpmps ps) | rpmpsi rpmpsInitIterator(rpmps ps) | |||
{ | { | |||
rpmpsi psi = NULL; | rpmpsi psi = NULL; | |||
if (ps != NULL) { | if (ps != NULL) { | |||
psi = xcalloc(1, sizeof(*psi)); | psi = (rpmpsi) xcalloc(1, sizeof(*psi)); | |||
/*@-assignexpose -castexpose @*/ | /*@-assignexpose -castexpose @*/ | |||
psi->ps = rpmpsLink(ps, "iter ref"); | psi->ps = rpmpsLink(ps, "iter ref"); | |||
/*@=assignexpose =castexpose @*/ | /*@=assignexpose =castexpose @*/ | |||
psi->ix = -1; | psi->ix = -1; | |||
} | } | |||
return psi; | return psi; | |||
} | } | |||
rpmpsi rpmpsFreeIterator(rpmpsi psi) | rpmpsi rpmpsFreeIterator(rpmpsi psi) | |||
{ | { | |||
skipping to change at line 132 | skipping to change at line 138 | |||
rpmProblem p; | rpmProblem p; | |||
char *t; | char *t; | |||
if (ps == NULL) return; | if (ps == NULL) return; | |||
if (ps->numProblems == ps->numProblemsAlloced) { | if (ps->numProblems == ps->numProblemsAlloced) { | |||
if (ps->numProblemsAlloced) | if (ps->numProblemsAlloced) | |||
ps->numProblemsAlloced *= 2; | ps->numProblemsAlloced *= 2; | |||
else | else | |||
ps->numProblemsAlloced = 2; | ps->numProblemsAlloced = 2; | |||
ps->probs = xrealloc(ps->probs, | ps->probs = (rpmProblem) xrealloc(ps->probs, | |||
ps->numProblemsAlloced * sizeof(*ps->probs)); | ps->numProblemsAlloced * sizeof(*ps->probs)); | |||
} | } | |||
p = ps->probs + ps->numProblems; | p = ps->probs + ps->numProblems; | |||
ps->numProblems++; | ps->numProblems++; | |||
memset(p, 0, sizeof(*p)); | memset(p, 0, sizeof(*p)); | |||
p->type = type; | p->type = type; | |||
p->key = key; | p->key = key; | |||
p->ulong1 = ulong1; | p->ulong1 = ulong1; | |||
p->ignoreProblem = 0; | p->ignoreProblem = 0; | |||
p->pkgNEVR = (pkgNEVR ? xstrdup(pkgNEVR) : NULL); | p->pkgNEVR = (pkgNEVR ? xstrdup(pkgNEVR) : NULL); | |||
p->altNEVR = (altNEVR ? xstrdup(altNEVR) : NULL); | p->altNEVR = (altNEVR ? xstrdup(altNEVR) : NULL); | |||
p->str1 = NULL; | p->str1 = NULL; | |||
if (dn != NULL || bn != NULL) { | if (dn != NULL || bn != NULL) { | |||
t = xcalloc(1, (dn != NULL ? strlen(dn) : 0) + | t = (char *) xcalloc(1, (dn != NULL ? strlen(dn) : 0) + | |||
(bn != NULL ? strlen(bn) : 0) + 1); | (bn != NULL ? strlen(bn) : 0) + 1); | |||
p->str1 = t; | p->str1 = t; | |||
if (dn != NULL) t = stpcpy(t, dn); | if (dn != NULL) t = stpcpy(t, dn); | |||
if (bn != NULL) t = stpcpy(t, bn); | if (bn != NULL) t = stpcpy(t, bn); | |||
} | } | |||
} | } | |||
#define XSTRCMP(a, b) ((!(a) && !(b)) || ((a) && (b) && !strcmp((a), (b)))) | #define XSTRCMP(a, b) ((!(a) && !(b)) || ((a) && (b) && !strcmp((a), (b)))) | |||
int rpmpsTrim(rpmps ps, rpmps filter) | int rpmpsTrim(rpmps ps, rpmps filter) | |||
skipping to change at line 234 | skipping to change at line 240 | |||
const char * rpmProblemString(const rpmProblem prob) | const char * rpmProblemString(const rpmProblem prob) | |||
{ | { | |||
/*@observer@*/ | /*@observer@*/ | |||
const char * pkgNEVR = (prob->pkgNEVR ? prob->pkgNEVR : "?pkgNEVR?"); | const char * pkgNEVR = (prob->pkgNEVR ? prob->pkgNEVR : "?pkgNEVR?"); | |||
/*@observer@*/ | /*@observer@*/ | |||
const char * altNEVR = (prob->altNEVR ? prob->altNEVR : "? ?altNEVR?"); | const char * altNEVR = (prob->altNEVR ? prob->altNEVR : "? ?altNEVR?"); | |||
/*@observer@*/ | /*@observer@*/ | |||
const char * str1 = (prob->str1 ? prob->str1 : N_("different")); | const char * str1 = (prob->str1 ? prob->str1 : N_("different")); | |||
size_t nb = strlen(pkgNEVR) + strlen(str1) + strlen(altNEVR) + 1 024; | size_t nb = strlen(pkgNEVR) + strlen(str1) + strlen(altNEVR) + 1 024; | |||
char * buf = xmalloc(nb+1); | char * buf = (char *) xmalloc(nb+1); | |||
int rc; | int rc; | |||
switch (prob->type) { | switch (prob->type) { | |||
case RPMPROB_BADPLATFORM: | case RPMPROB_BADPLATFORM: | |||
rc = snprintf(buf, nb, | rc = snprintf(buf, nb, | |||
_("package %s is intended for a %s platform"), | _("package %s is intended for a %s platform"), | |||
pkgNEVR, str1); | pkgNEVR, str1); | |||
break; | break; | |||
case RPMPROB_PKG_INSTALLED: | case RPMPROB_PKG_INSTALLED: | |||
rc = snprintf(buf, nb, | rc = snprintf(buf, nb, | |||
End of changes. 6 change blocks. | ||||
5 lines changed or deleted | 11 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |