RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/build/ parsePreamble.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Sun 14 Oct 2007 - 20:21:56 CEST
Message-Id: <20071014182156.B62E2348466@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:   14-Oct-2007 20:21:56
  Branch: HEAD                             Handle: 2007101419215600

  Modified files:
    rpm                     CHANGES
    rpm/build               parsePreamble.c

  Log:
    - parsePreamble.c: use headerGetExtension everywhere.

  Summary:
    Revision    Changes     Path
    1.1702      +1  -0      rpm/CHANGES
    2.132       +41 -26     rpm/build/parsePreamble.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1701 -r1.1702 CHANGES
  --- rpm/CHANGES	14 Oct 2007 18:08:19 -0000	1.1701
  +++ rpm/CHANGES	14 Oct 2007 18:21:56 -0000	1.1702
  @@ -1,4 +1,5 @@
   4.5 -> 5.0:
  +    - jbj: parsePreamble.c: use headerGetExtension everywhere.
       - jbj: pack.c: use headerGetExtension everywhere.
       - jbj: files.c: fix: append to pkg->fileList.
       - jbj: files.c: use headerGetExtension everywhere.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/parsePreamble.c
  ============================================================================
  $ cvs diff -u -r2.131 -r2.132 parsePreamble.c
  --- rpm/build/parsePreamble.c	11 Oct 2007 13:04:26 -0000	2.131
  +++ rpm/build/parsePreamble.c	14 Oct 2007 18:21:56 -0000	2.132
  @@ -211,22 +211,26 @@
   static int isMemberInEntry(Header h, const char *name, rpmTag tag)
   	/*@*/
   {
  -    HGE_t hge = (HGE_t)headerGetEntryMinMemory;
  -    HFD_t hfd = headerFreeData;
  -    const char ** names;
  -    rpmTagType type;
  -    int count;
  +    HGE_t hge = (HGE_t)headerGetExtension;
  +    int_32 he_t = 0;
  +    hRET_t he_p = { .ptr = NULL };
  +    int_32 he_c = 0;
  +    HE_s he_s = { .tag = 0, .t = &he_t, .p = &he_p, .c = &he_c, .freeData = 0 };
  +    HE_t he = &he_s;
  +    int xx;
   
  -    if (!hge(h, tag, &type, &names, &count))
  +    he->tag = tag;
  +    xx = hge(h, he->tag, he->t, he->p, he->c);
  +    if (!xx)
   	return -1;
   /*@-boundsread@*/
  -    while (count--) {
  -	if (!xstrcasecmp(names[count], name))
  +    while (he_c--) {
  +	if (!xstrcasecmp(he_p.argv[he_c], name))
   	    break;
       }
  -    names = hfd(names, type);
  +    he_p.ptr = _free(he_p.ptr);
   /*@=boundsread@*/
  -    return (count >= 0 ? 1 : 0);
  +    return (he_c >= 0 ? 1 : 0);
   }
   
   /**
  @@ -438,8 +442,14 @@
   
   spectag stashSt(Spec spec, Header h, int tag, const char * lang)
   {
  -    HGE_t hge = (HGE_t)headerGetEntryMinMemory;
  +    HGE_t hge = (HGE_t)headerGetExtension;
  +    int_32 he_t = 0;
  +    hRET_t he_p = { .ptr = NULL };
  +    int_32 he_c = 0;
  +    HE_s he_s = { .tag = 0, .t = &he_t, .p = &he_p, .c = &he_c, .freeData = 0 };
  +    HE_t he = &he_s;
       spectag t = NULL;
  +    int xx;
   
       if (spec->st) {
   	spectags st = spec->st;
  @@ -454,12 +464,14 @@
   	t->t_lang = xstrdup(lang);
   	t->t_msgid = NULL;
   	if (!(t->t_lang && strcmp(t->t_lang, RPMBUILD_DEFAULT_LANG))) {
  -	    char *n;
  -	    if (hge(h, RPMTAG_NAME, NULL, &n, NULL)) {
  +	    he->tag = RPMTAG_NAME;
  +	    xx = hge(h, he->tag, he->t, he->p, he->c);
  +	    if (xx) {
   		char buf[1024];
  -		sprintf(buf, "%s(%s)", n, tagName(tag));
  +		sprintf(buf, "%s(%s)", he_p.str, tagName(tag));
   		t->t_msgid = xstrdup(buf);
   	    }
  +	    he_p.ptr = _free(he_p.ptr);
   	}
       }
       /*@-usereleased -compdef@*/
  @@ -491,14 +503,16 @@
   		pkg->header, pkg->autoProv, pkg->autoReq, pkg->icon,
   		rpmGlobalMacroContext, fileSystem, internalState @*/
   {
  -    HGE_t hge = (HGE_t)headerGetEntryMinMemory;
  -    HFD_t hfd = headerFreeData;
  +    HGE_t hge = (HGE_t)headerGetExtension;
  +    int_32 he_t = 0;
  +    hRET_t he_p = { .ptr = NULL };
  +    int_32 he_c = 0;
  +    HE_s he_s = { .tag = 0, .t = &he_t, .p = &he_p, .c = &he_c, .freeData = 0 };
  +    HE_t he = &he_s;
       char * field = spec->line;
       char * end;
  -    char ** array;
       int multiToken = 0;
       rpmsenseFlags tagflags;
  -    rpmTagType type;
       int len;
       int num;
       int rc;
  @@ -592,26 +606,27 @@
       case RPMTAG_VARIANTS:
       case RPMTAG_PREFIXES:
   	addOrAppendListEntry(pkg->header, tag, field);
  -	xx = hge(pkg->header, tag, &type, &array, &num);
  +	he->tag = tag;
  +	xx = hge(pkg->header, he->tag, he->t, he->p, he->c);
   	if (tag == RPMTAG_PREFIXES)
  -	while (num--) {
  -	    if (array[num][0] != '/') {
  +	while (he_c--) {
  +	    if (he_p.argv[he_c][0] != '/') {
   		rpmlog(RPMLOG_ERR,
   			 _("line %d: Prefixes must begin with \"/\": %s\n"),
   			 spec->lineNum, spec->line);
  -		array = hfd(array, type);
  +		he_p.ptr = _free(he_p.ptr);
   		return RPMRC_FAIL;
   	    }
  -	    len = strlen(array[num]);
  -	    if (array[num][len - 1] == '/' && len > 1) {
  +	    len = strlen(he_p.argv[he_c]);
  +	    if (he_p.argv[he_c][len - 1] == '/' && len > 1) {
   		rpmlog(RPMLOG_ERR,
   			 _("line %d: Prefixes must not end with \"/\": %s\n"),
   			 spec->lineNum, spec->line);
  -		array = hfd(array, type);
  +		he_p.ptr = _free(he_p.ptr);
   		return RPMRC_FAIL;
   	    }
   	}
  -	array = hfd(array, type);
  +	he_p.ptr = _free(he_p.ptr);
   	break;
       case RPMTAG_DOCDIR:
   	SINGLE_TOKEN_ONLY;
  @@ .
Received on Sun Oct 14 20:21:56 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.