RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/rpmdb/ header.c header.h

From: Jeff Johnson <jbj@rpm5.org>
Date: Sun 07 Oct 2007 - 20:58:33 CEST
Message-Id: <20071007185833.BA0BC34847D@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   07-Oct-2007 20:58:33
  Branch: HEAD                             Handle: 2007100719583300

  Modified files:
    rpm                     CHANGES
    rpm/rpmdb               header.c header.h

  Log:
    - unbork/simplify hRET_t indirections, too much acid in the Kool-Aid.

  Summary:
    Revision    Changes     Path
    1.1659      +1  -0      rpm/CHANGES
    1.69        +16 -12     rpm/rpmdb/header.c
    1.28        +2  -6      rpm/rpmdb/header.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1658 -r1.1659 CHANGES
  --- rpm/CHANGES	7 Oct 2007 16:57:00 -0000	1.1658
  +++ rpm/CHANGES	7 Oct 2007 18:58:33 -0000	1.1659
  @@ -1,4 +1,5 @@
   4.5 -> 5.0:
  +    - jbj: unbork/simplify hRET_t indirections, too much acid in the Kool-Aid.
       - jbj: rpmdeps: unhide various CLI options.
       - jbj: rpmdeps: invoke rpm, not /bin/rpm.
       - bero: fix: RPMRC_FAIL, not non-existent RPMRC_BAD, return.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header.c
  ============================================================================
  $ cvs diff -u -r1.68 -r1.69 header.c
  --- rpm/rpmdb/header.c	7 Oct 2007 15:59:46 -0000	1.68
  +++ rpm/rpmdb/header.c	7 Oct 2007 18:58:33 -0000	1.69
  @@ -1810,7 +1810,7 @@
   static
   int headerGetExtension(Header h, int_32 tag,
   			/*@null@*/ /*@out@*/ hTYP_t type,
  -			/*@null@*/ /*@out@*/ void * p,
  +			/*@null@*/ /*@out@*/ hRET_t * p,
   			/*@null@*/ /*@out@*/ hCNT_t c)
   	/*@globals headerCompoundFormats @*/
   	/*@modifies *type, *p, *c @*/
  @@ -1835,7 +1835,7 @@
       memset(he, 0, sizeof(*he));
       he->tag = tag;
       he->t = &he_t;
  -    he->p.ret = (p ? &he_p : NULL);
  +    he->p = (p ? &he_p : NULL);
       he->c = &he_c;
   
       /* Search extensions for specific tag override. */
  @@ -1849,11 +1849,11 @@
       }
   
       if (ext && ext->name != NULL && ext->type == HEADER_EXT_TAG)
  -	rc = ext->u.tagFunction(h, he->t, he->p.ptr, he->c, &he->freeData);
  +	rc = ext->u.tagFunction(h, he->t, (hPTR_t *)he->p, he->c, &he->freeData);
       else
  -	rc = intGetEntry(h, he->tag, he->t, he->p.ptr, he->c, 0);
  +	rc = intGetEntry(h, he->tag, he->t, (hPTR_t *)he->p, he->c, 0);
   
  -    if (he->p.ret)
  +    if (he->p && !he->freeData)
       switch (*he->t) {
       case RPM_NULL_TYPE:
       case RPM_OPENPGP_TYPE:	/* XXX W2DO? */
  @@ -1864,28 +1864,32 @@
   	break;
       case RPM_CHAR_TYPE:
       case RPM_INT8_TYPE:
  -	nb = he_c * sizeof(*he_p->i8p);
  +assert(0);	/* XXX stop unimplemented oversights. */
  +	nb = he_c * sizeof(*he_p.i8p);
   	break;
       case RPM_INT16_TYPE:
  -	nb = he_c * sizeof(*he_p->i16p);
  +assert(0);	/* XXX stop unimplemented oversights. */
  +	nb = he_c * sizeof(*he_p.i16p);
   	break;
       case RPM_INT32_TYPE:
  -	nb = he_c * sizeof(*he_p->i32p);
  +assert(0);	/* XXX stop unimplemented oversights. */
  +	nb = he_c * sizeof(*he_p.i32p);
   	break;
       case RPM_INT64_TYPE:
  -	nb = he_c * sizeof(*he_p->i64p);
  +assert(0);	/* XXX stop unimplemented oversights. */
  +	nb = he_c * sizeof(*he_p.i64p);
   	break;
       case RPM_I18NSTRING_TYPE:
       case RPM_STRING_TYPE:
  -	nb = he_c * sizeof(*he_p->str);
  +	nb = strlen(he_p.str);
   	break;
       case RPM_STRING_ARRAY_TYPE:
   	break;
       }
   
       if (p)
  -	*(void **)p = ((nb > 0 && !he->freeData)
  -		? memcpy(xmalloc(nb), he_p->ptr, nb) : he_p->ptr);
  +	p->ptr = ((nb > 0)
  +		? memcpy(xmalloc(nb), he_p.ptr, nb) : he_p.ptr);
   
       if (type)
   	*type = *he->t;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header.h
  ============================================================================
  $ cvs diff -u -r1.27 -r1.28 header.h
  --- rpm/rpmdb/header.h	7 Oct 2007 15:59:46 -0000	1.27
  +++ rpm/rpmdb/header.h	7 Oct 2007 18:58:33 -0000	1.28
  @@ -307,7 +307,7 @@
   /**
    */
   /*@-typeuse -fielduse@*/
  -typedef union hRET_s * hRET_t;
  +typedef union hRET_s hRET_t;
   #if !defined(SWIG)
   union hRET_s {
       void * ptr;
  @@ -333,12 +333,8 @@
       int_32 tag;
   /*@null@*/
       hTYP_t t;
  -    union {
   /*@null@*/
  -	hPTR_t * ptr;
  -/*@null@*/
  -	hRET_t * ret;
  -    } p;
  +    hRET_t * p;
   /*@null@*/
       hCNT_t c;
       int freeData;
  @@ .
Received on Sun Oct 7 20:58:33 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.