summaryrefslogtreecommitdiff
path: root/lib/headerfmt.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-05-20 11:57:30 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-05-21 12:04:50 +0300
commitfae1edeb939e761a7fd070081d378a2a67a485f9 (patch)
treef773e7fb88d37ad5c5e31b54af4b0a0fab1cbab1 /lib/headerfmt.c
parent845eb8fc70493da08e9cf31749796dbb976aa657 (diff)
downloadlibrpm-tizen-fae1edeb939e761a7fd070081d378a2a67a485f9.tar.gz
librpm-tizen-fae1edeb939e761a7fd070081d378a2a67a485f9.tar.bz2
librpm-tizen-fae1edeb939e761a7fd070081d378a2a67a485f9.zip
Lose padding argument from formatters
- formatPrefix already contains the padding, just use rasprintf() on that to get properly allocated buffer without messing with it manually - xml format doesn't honor padding anyway so don't bother with it
Diffstat (limited to 'lib/headerfmt.c')
-rw-r--r--lib/headerfmt.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/headerfmt.c b/lib/headerfmt.c
index 77c36076f..70e4aab7e 100644
--- a/lib/headerfmt.c
+++ b/lib/headerfmt.c
@@ -22,11 +22,9 @@
*
* @param td tag data container
* @param formatPrefix
- * @param padding
* @return formatted string
*/
-typedef char * (*headerTagFormatFunction)
- (rpmtd td, char * formatPrefix, size_t padding);
+typedef char * (*headerTagFormatFunction) (rpmtd td, char * formatPrefix);
extern void *rpmHeaderFormatFuncByName(const char *fmt);
@@ -40,7 +38,6 @@ struct sprintfTag_s {
int arrayCount;
char * format;
char * type;
- int pad;
};
/** \ingroup header
@@ -344,7 +341,6 @@ static int parseFormat(headerSprintfArgs hsa, char * str,
}
token->u.tag.format = start;
- token->u.tag.pad = 0;
token->u.tag.justOne = 0;
token->u.tag.arrayCount = 0;
@@ -359,14 +355,7 @@ static int parseFormat(headerSprintfArgs hsa, char * str,
*chptr++ = '\0';
while (start < chptr) {
- if (risdigit(*start)) {
- i = strtoul(start, &start, 10);
- token->u.tag.pad += i;
- start = chptr;
- break;
- } else {
- start++;
- }
+ start++;
}
if (*start == '=') {
@@ -675,7 +664,7 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
(void) stpcpy( stpcpy(buf, "%"), tag->format);
- val = tag->fmt(td, buf, tag->pad);
+ val = tag->fmt(td, buf);
need = strlen(val);
if (val && need > 0) {