Eliminate unused spectag and speclines goo from spec
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 29 Oct 2010 07:12:53 +0000 (10:12 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 29 Oct 2010 07:12:53 +0000 (10:12 +0300)
- These were used, back in the day, to implement a hidden --specedit
  switch, which in all its glory did: print a copy of a spec file,
  with group, summary and description looked up from specspo.
  This huge pile of junk was left behind from kicking out the
  useless "feature" in commits 7b95061d3b77d8e6b3c80e856b66f49b393511ba and
  0f991a14209054da7c45c46e96750738fc62874d.

build/parseDescription.c
build/parsePreamble.c
build/parseSpec.c
build/rpmbuild_internal.h
build/spec.c

index c0226c3..3ea48e6 100644 (file)
@@ -22,7 +22,6 @@ int parseDescription(rpmSpec spec)
     const char *name = NULL;
     const char *lang = RPMBUILD_DEFAULT_LANG;
     poptContext optCon = NULL;
-    spectag t = NULL;
     struct poptOption optionsTable[] = {
        { NULL, 'n', POPT_ARG_STRING, &name, 'n', NULL, NULL},
        { NULL, 'l', POPT_ARG_STRING, &lang, 'l', NULL, NULL},
@@ -78,8 +77,6 @@ int parseDescription(rpmSpec spec)
     }
 #endif
 
-    t = stashSt(spec, pkg->header, RPMTAG_DESCRIPTION, lang);
-    
     sb = newStringBuf();
 
     if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
@@ -90,7 +87,6 @@ int parseDescription(rpmSpec spec)
     } else {
        while (! (nextPart = isPart(spec->line))) {
            appendLineStringBuf(sb, spec->line);
-           if (t) t->t_nlines++;
            if ((rc =
                readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
                nextPart = PART_NONE;
index 7f09db8..f96713e 100644 (file)
@@ -585,30 +585,6 @@ exit:
     return rc;
 }
 
-spectag stashSt(rpmSpec spec, Header h, rpmTagVal tag, const char * lang)
-{
-    spectag t = NULL;
-
-    if (spec->st) {
-       spectags st = spec->st;
-       if (st->st_ntags == st->st_nalloc) {
-           st->st_nalloc += 10;
-           st->st_t = xrealloc(st->st_t, st->st_nalloc * sizeof(*(st->st_t)));
-       }
-       t = st->st_t + st->st_ntags++;
-       t->t_tag = tag;
-       t->t_startx = spec->lineNum - 1;
-       t->t_nlines = 1;
-       t->t_lang = xstrdup(lang);
-       t->t_msgid = NULL;
-       if (!(t->t_lang && !rstreq(t->t_lang, RPMBUILD_DEFAULT_LANG))) {
-           rasprintf(&t->t_msgid, "%s(%s)", 
-                     headerGetString(h, RPMTAG_NAME), rpmTagGetName(tag));
-       }
-    }
-    return t;
-}
-
 #define SINGLE_TOKEN_ONLY \
 if (multiToken) { \
     rpmlog(RPMLOG_ERR, _("line %d: Tag takes single token only: %s\n"), \
@@ -708,7 +684,6 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
        break;
     case RPMTAG_GROUP:
     case RPMTAG_SUMMARY:
-       (void) stashSt(spec, pkg->header, tag, lang);
     case RPMTAG_DISTRIBUTION:
     case RPMTAG_VENDOR:
     case RPMTAG_LICENSE:
index 3f912dd..8f2db6d 100644 (file)
@@ -275,15 +275,6 @@ retry:
        ofi->readPtr = ofi->readBuf;
        ofi->lineNum++;
        spec->lineNum = ofi->lineNum;
-       if (spec->sl) {
-           speclines sl = spec->sl;
-           if (sl->sl_nlines == sl->sl_nalloc) {
-               sl->sl_nalloc += 100;
-               sl->sl_lines = (char **) xrealloc(sl->sl_lines, 
-                       sl->sl_nalloc * sizeof(*(sl->sl_lines)));
-           }
-           sl->sl_lines[sl->sl_nlines++] = xstrdup(ofi->readBuf);
-       }
     }
     return 0;
 }
index 1c58870..f0b2e46 100644 (file)
@@ -19,26 +19,6 @@ typedef struct ReadLevelEntry {
     struct ReadLevelEntry * next;
 } RLE_t;
 
-typedef struct spectag_s {
-    int t_tag;
-    int t_startx;
-    int t_nlines;
-    char * t_lang;
-    char * t_msgid;
-} * spectag;
-
-struct spectags_s {
-    spectag st_t;
-    int st_nalloc;
-    int st_ntags;
-};
-
-struct speclines_s {
-    char **sl_lines;
-    int sl_nalloc;
-    int sl_nlines;
-};
-
 /** \ingroup rpmbuild
  */
 struct Source {
@@ -49,8 +29,6 @@ struct Source {
 struct Source * next;
 };
 
-typedef struct spectags_s * spectags;
-typedef struct speclines_s * speclines;
 typedef struct Package_s * Package;
 
 /** \ingroup rpmbuild
@@ -62,9 +40,6 @@ struct rpmSpec_s {
     char * buildSubdir;
     const char * rootDir;
 
-    speclines sl;
-    spectags st;
-
     struct OpenFileInfo * fileStack;
     char lbuf[10*BUFSIZ];
     char *lbufPtr;
@@ -291,16 +266,6 @@ RPM_GNUC_INTERNAL
 rpmRC rpmCharCheck(rpmSpec spec, char *field, size_t fsize, const char *whitelist);
 
 /** \ingroup rpmbuild
- * stashSt.
- * @param spec         spec file control structure
- * @param h            header
- * @param tag          tag
- * @param lang         locale
- */
-RPM_GNUC_INTERNAL
-spectag stashSt(rpmSpec spec, Header h, rpmTagVal tag, const char * lang);
-
-/** \ingroup rpmbuild
  * Parse dependency relations from spec file and/or autogenerated output buffer.
  * @param spec         spec file control structure
  * @param pkg          package control structure
index fc27923..9fbaa22 100644 (file)
@@ -159,44 +159,12 @@ static Package freePackages(Package packages)
     return NULL;
 }
 
-/**
- */
-static inline speclines freeSl(speclines sl)
-{
-    int i;
-    if (sl == NULL) return NULL;
-    for (i = 0; i < sl->sl_nlines; i++)
-       sl->sl_lines[i] = _free(sl->sl_lines[i]);
-    sl->sl_lines = _free(sl->sl_lines);
-    _free(sl);
-    return NULL;
-}
-
-/**
- */
-static inline spectags freeSt(spectags st)
-{
-    int i;
-    if (st == NULL) return NULL;
-    for (i = 0; i < st->st_ntags; i++) {
-       spectag t = st->st_t + i;
-       t->t_lang = _free(t->t_lang);
-       t->t_msgid = _free(t->t_msgid);
-    }
-    st->st_t = _free(st->st_t);
-    _free(st);
-    return NULL;
-}
-
 rpmSpec newSpec(void)
 {
     rpmSpec spec = xcalloc(1, sizeof(*spec));
     
     spec->specFile = NULL;
 
-    spec->sl = NULL;
-    spec->st = NULL;
-
     spec->fileStack = NULL;
     spec->lbuf[0] = '\0';
     spec->line = spec->lbuf;
@@ -255,9 +223,6 @@ rpmSpec rpmSpecFree(rpmSpec spec)
 
     if (spec == NULL) return NULL;
 
-    spec->sl = freeSl(spec->sl);
-    spec->st = freeSt(spec->st);
-
     spec->prep = freeStringBuf(spec->prep);
     spec->build = freeStringBuf(spec->build);
     spec->install = freeStringBuf(spec->install);