Convert internal uses of headerSprintf() to headerFormat()
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 12 May 2008 13:20:13 +0000 (16:20 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 12 May 2008 13:20:13 +0000 (16:20 +0300)
build/pack.c
build/parsePreamble.c
build/spec.c
lib/header.h
lib/query.c
lib/rpmcli.h
lib/rpminstall.c
lib/rpmts.c
python/header-py.c

index a3afb0f..3f74570 100644 (file)
@@ -692,8 +692,7 @@ rpmRC packageBinaries(rpmSpec spec)
        
        {   char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
            char *binRpm, *binDir;
-           binRpm = headerSprintf(pkg->header, binFormat, rpmTagTable,
-                              rpmHeaderFormats, &errorString);
+           binRpm = headerFormat(pkg->header, binFormat, &errorString);
            binFormat = _free(binFormat);
            if (binRpm == NULL) {
                const char *name;
index f606100..6e5b5a9 100644 (file)
@@ -337,8 +337,7 @@ static int getSpecialDocDir(Package pkg)
     if (fmt_macro && strlen(fmt_macro) > 0) {
        docdir_fmt = fmt_macro;
     }
-    fmt = headerSprintf(pkg->header, docdir_fmt, 
-                       rpmTagTable, rpmHeaderFormats, &errstr);
+    fmt = headerFormat(pkg->header, docdir_fmt, &errstr);
     if (!fmt) {
        rpmlog(RPMLOG_ERR, _("illegal _docdir_fmt: %s\n"), errstr);
        goto exit;
index 038839c..9a267b8 100644 (file)
@@ -607,7 +607,7 @@ printNewSpecfile(rpmSpec spec)
        rasprintf(&fmt, "%%{%s}", tn);
        msgstr = _free(msgstr);
 
-       msgstr = headerSprintf(h, fmt, rpmTagTable, rpmHeaderFormats, &errstr);
+       msgstr = headerFormat(h, fmt, &errstr);
        if (msgstr == NULL) {
            rpmlog(RPMLOG_ERR, _("can't query %s: %s\n"), tn, errstr);
            return;
index 151ec1a..e382028 100644 (file)
@@ -413,7 +413,6 @@ char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
 /** \ingroup header
  * Return formatted output string from header tags.
  * The returned string must be free()d.
- * @deprecated         Use headerFormat() instead
  *
  * @param h            header
  * @param fmt          format to use
index 41e120f..47bd596 100644 (file)
@@ -108,7 +108,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
 
     if (qva->qva_queryFormat != NULL) {
        const char *errstr;
-       char *str = headerSprintf(h, qva->qva_queryFormat, rpmTagTable, rpmHeaderFormats, &errstr);
+       char *str = headerFormat(h, qva->qva_queryFormat, &errstr);
 
        if ( str != NULL ) {
            rpmlog(RPMLOG_NOTICE, "%s", str);
index e8f348e..8c16226 100644 (file)
@@ -179,7 +179,7 @@ struct rpmQVKArguments_s {
     QVF_t qva_showPackage;     /*!< Function to display iterator matches. */
     QSpecF_t qva_specQuery;    /*!< Function to query spec file. */
     int qva_verbose;           /*!< (unused) */
-    char * qva_queryFormat;    /*!< Format for headerSprintf(). */
+    char * qva_queryFormat;    /*!< Format for headerFormat(). */
     int sign;                  /*!< Is a passphrase needed? */
     const char * passPhrase;   /*!< Pass phrase. */
     const char * qva_prefix;   /*!< Path to top of install tree. */
@@ -381,7 +381,7 @@ extern int rpmcliProgressTotal;
 
 /** \ingroup rpmcli
  * The rpm CLI generic transaction callback handler.
- * @todo Remove headerSprintf() from the progress callback.
+ * @todo Remove headerFormat() from the progress callback.
  * @deprecated Transaction callback arguments need to change, so don't rely on
  * this routine in the rpmcli API.
  *
index 86ea1b7..2b24a1d 100644 (file)
@@ -117,10 +117,9 @@ void * rpmShowProgress(const void * arg,
        rpmcliHashesCurrent = 0;
        if (h == NULL || !(flags & INSTALL_LABEL))
            break;
-       /* @todo Remove headerSprintf() on a progress callback. */
+       /* @todo Remove headerFormat() on a progress callback. */
        if (flags & INSTALL_HASH) {
-           s = headerSprintf(h, "%{NAME}",
-                               rpmTagTable, rpmHeaderFormats, NULL);
+           s = headerFormat(h, "%{NAME}", NULL);
            if (isatty (STDOUT_FILENO))
                fprintf(stdout, "%4d:%-23.23s", rpmcliProgressCurrent + 1, s);
            else
@@ -128,8 +127,7 @@ void * rpmShowProgress(const void * arg,
            (void) fflush(stdout);
            s = _free(s);
        } else {
-           s = headerSprintf(h, "%{NAME}-%{VERSION}-%{RELEASE}",
-                                 rpmTagTable, rpmHeaderFormats, NULL);
+           s = headerFormat(h, "%{NAME}-%{VERSION}-%{RELEASE}", NULL);
            fprintf(stdout, "%s\n", s);
            (void) fflush(stdout);
            s = _free(s);
index ad0984a..7c81dc1 100644 (file)
@@ -419,7 +419,7 @@ rpmRC rpmtsImportPubkey(const rpmts ts, const unsigned char * pkt, size_t pktlen
     xx = headerAddOrAppendEntry(h, RPMTAG_PUBKEYS,
                        RPM_STRING_ARRAY_TYPE, &enc, 1);
 
-    d = headerSprintf(h, afmt, rpmTagTable, rpmHeaderFormats, NULL);
+    d = headerFormat(h, afmt, NULL);
     if (d == NULL)
        goto exit;
 
@@ -619,7 +619,7 @@ int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
     qfmt = rpmExpand("%{?_solve_name_fmt}", NULL);
     if (qfmt == NULL || *qfmt == '\0')
        goto exit;
-    str = headerSprintf(bh, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
+    str = headerFormat(bh, qfmt, &errstr);
     bh = headerFree(bh);
     qfmt = _free(qfmt);
     if (str == NULL) {
index 605afec..667384b 100644 (file)
@@ -276,7 +276,7 @@ static PyObject * hdrSprintf(hdrObject * s, PyObject * args, PyObject * kwds)
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &fmt))
        return NULL;
 
-    r = headerSprintf(s->h, fmt, rpmTagTable, rpmHeaderFormats, &err);
+    r = headerFormat(s->h, fmt, &err);
     if (!r) {
        PyErr_SetString(pyrpmError, err);
        return NULL;
@@ -391,7 +391,7 @@ static int dressedHeaderGetEntry(Header h, rpmTag tag, rpmTagType *type,
        (void) stpcpy( stpcpy( stpcpy( fmt, "%{"), rpmTagGetName(tag)), "}\n");
 
        /* XXX FIXME: memory leak. */
-        msgstr = headerSprintf(h, fmt, rpmTagTable, rpmHeaderFormats, &errstr);
+        msgstr = headerFormat(h, fmt, &errstr);
        if (msgstr) {
            *p = (void *) msgstr;
            if (type)   *type = RPM_STRING_TYPE;