rpmevr.c   rpmevr.c 
skipping to change at line 20 skipping to change at line 20
#include <rpmlog.h> #include <rpmlog.h>
#include <set.h> #include <set.h>
#include <rpmtag.h> #include <rpmtag.h>
#define _RPMEVR_INTERNAL #define _RPMEVR_INTERNAL
#include <rpmevr.h> #include <rpmevr.h>
#include "debug.h" #include "debug.h"
#ifdef __cplusplus
GENfree(EVR_t)
#endif /* __cplusplus */
/*@unchecked@*/ /*@unchecked@*/
int _rpmevr_debug = 0; int _rpmevr_debug = 0;
#if !defined(MAX) #if !defined(MAX)
#define MAX(x, y) ( ((x)>(y))?(x):(y) ) #define MAX(x, y) ( ((x)>(y))?(x):(y) )
#endif #endif
EVR_t rpmEVRnew(uint32_t Flags, int initialize) EVR_t rpmEVRnew(uint32_t Flags, int initialize)
{ {
EVR_t evr = xcalloc(1, sizeof(*evr)); EVR_t evr = (EVR_t) xcalloc(1, sizeof(*evr));
evr->Flags = Flags; evr->Flags = (evrFlags) Flags;
if (initialize) { if (initialize) {
/*@-observertrans -readonlytrans @*/ /*@-observertrans -readonlytrans @*/
evr->F[RPMEVR_E] = "0"; evr->F[RPMEVR_E] = "0";
evr->F[RPMEVR_V] = ""; evr->F[RPMEVR_V] = "";
evr->F[RPMEVR_R] = ""; evr->F[RPMEVR_R] = "";
evr->F[RPMEVR_D] = ""; evr->F[RPMEVR_D] = "";
/*@=observertrans =readonlytrans @*/ /*@=observertrans =readonlytrans @*/
} }
return evr; return evr;
} }
skipping to change at line 366 skipping to change at line 370
/*@-redecl@*/ /*@-redecl@*/
int (*rpmvercmp) (const char *a, const char *b) = rpmEVRcmp; int (*rpmvercmp) (const char *a, const char *b) = rpmEVRcmp;
/*@=redecl@*/ /*@=redecl@*/
/** /**
*/ */
/*@unchecked@*/ /*@observer@*/ /*@unchecked@*/ /*@observer@*/
static struct EVRop_s { static struct EVRop_s {
/*@observer@*/ /*@null@*/ /*@observer@*/ /*@null@*/
const char * operator; const char * opstr;
rpmsenseFlags sense; rpmsenseFlags sense;
} cops[] = { } cops[] = {
{ "<=", RPMSENSE_LESS ^ RPMSENSE_EQUAL}, { "<=", (rpmsenseFlags) (RPMSENSE_LESS ^ RPMSENSE_EQUAL) },
{ "=<", RPMSENSE_LESS ^ RPMSENSE_EQUAL}, { "=<", (rpmsenseFlags) (RPMSENSE_LESS ^ RPMSENSE_EQUAL) },
{ "==", RPMSENSE_EQUAL}, { "==", (rpmsenseFlags) (RPMSENSE_EQUAL) },
{ "!=", RPMSENSE_NOTEQUAL}, { "!=", (rpmsenseFlags) (RPMSENSE_NOTEQUAL) },
{ ">=", RPMSENSE_GREATER ^ RPMSENSE_EQUAL}, { ">=", (rpmsenseFlags) (RPMSENSE_GREATER ^ RPMSENSE_EQUAL) },
{ "=>", RPMSENSE_GREATER ^ RPMSENSE_EQUAL}, { "=>", (rpmsenseFlags) (RPMSENSE_GREATER ^ RPMSENSE_EQUAL) },
{ "<", RPMSENSE_LESS}, { "<", (rpmsenseFlags) (RPMSENSE_LESS) },
{ "=", RPMSENSE_EQUAL}, { "=", (rpmsenseFlags) (RPMSENSE_EQUAL) },
{ ">", RPMSENSE_GREATER}, { ">", (rpmsenseFlags) (RPMSENSE_GREATER) },
{ NULL, 0 }, { NULL, (rpmsenseFlags) 0 },
}; };
rpmsenseFlags rpmEVRflags(const char *op, const char **end) rpmsenseFlags rpmEVRflags(const char *op, const char **end)
{ {
rpmsenseFlags Flags = 0; rpmsenseFlags Flags = (rpmsenseFlags) 0;
struct EVRop_s *cop; struct EVRop_s *cop;
if (op == NULL || *op == '\0') if (op == NULL || *op == '\0')
Flags = RPMSENSE_EQUAL; Flags = RPMSENSE_EQUAL;
else else
for (cop = cops; cop->operator != NULL; cop++) { for (cop = cops; cop->opstr != NULL; cop++) {
if (strncmp(op, cop->operator, strlen(cop->operator))) if (strncmp(op, cop->opstr, strlen(cop->opstr)))
continue; continue;
Flags = cop->sense; Flags = cop->sense;
if (end) if (end)
*end = op + strlen(cop->operator); *end = op + strlen(cop->opstr);
break; break;
} }
return Flags; return Flags;
} }
int rpmVersionCompare(Header A, Header B) int rpmVersionCompare(Header A, Header B)
{ {
HE_t Ahe = memset(alloca(sizeof(*Ahe)), 0, sizeof(*Ahe)); HE_t Ahe = (HE_t) memset(alloca(sizeof(*Ahe)), 0, sizeof(*Ahe));
HE_t Bhe = memset(alloca(sizeof(*Bhe)), 0, sizeof(*Bhe)); HE_t Bhe = (HE_t) memset(alloca(sizeof(*Bhe)), 0, sizeof(*Bhe));
const char * one, * two; const char * one, * two;
rpmuint32_t Eone, Etwo; rpmuint32_t Eone, Etwo;
const char * s; const char * s;
int rc = 0; int rc = 0;
int xx; int xx;
for (s = rpmEVRorder(); *s != '\0'; s++) { for (s = rpmEVRorder(); *s != '\0'; s++) {
switch ((int)*s) { switch ((int)*s) {
default: continue; /*@notreached@*/ /*@switchbreak@*/br eak; default: continue; /*@notreached@*/ /*@switchbreak@*/br eak;
case 'E': case 'E':
 End of changes. 12 change blocks. 
19 lines changed or deleted 23 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/