From d4879f3e6e2ab65e1ad76869896cf407248bc993 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 21 Sep 2010 12:45:53 +0300 Subject: [PATCH] Move format extension table a bit to avoid unnecessary forward declaration --- lib/formats.c | 52 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/lib/formats.c b/lib/formats.c index c377370f4..bf1ee22b5 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -29,9 +29,6 @@ struct headerFormatFunc_s { headerTagFormatFunction func; /*!< Pointer to formatter function. */ }; -/* forward declarations */ -static const struct headerFormatFunc_s rpmHeaderFormats[]; - /** * barebones string representation with no extra formatting * @param td tag data container @@ -652,6 +649,31 @@ static char * expandFormat(rpmtd td, char * formatPrefix) return val; } +static const struct headerFormatFunc_s rpmHeaderFormats[] = { + { RPMTD_FORMAT_STRING, "string", stringFormat }, + { RPMTD_FORMAT_ARMOR, "armor", armorFormat }, + { RPMTD_FORMAT_BASE64, "base64", base64Format }, + { RPMTD_FORMAT_PGPSIG, "pgpsig", pgpsigFormat }, + { RPMTD_FORMAT_DEPFLAGS, "depflags", depflagsFormat }, + { RPMTD_FORMAT_DEPTYPE, "deptype", deptypeFormat }, + { RPMTD_FORMAT_FFLAGS, "fflags", fflagsFormat }, + { RPMTD_FORMAT_PERMS, "perms", permsFormat }, + { RPMTD_FORMAT_PERMS, "permissions", permsFormat }, + { RPMTD_FORMAT_TRIGGERTYPE, "triggertype", triggertypeFormat }, + { RPMTD_FORMAT_XML, "xml", xmlFormat }, + { RPMTD_FORMAT_OCTAL, "octal", octalFormat }, + { RPMTD_FORMAT_HEX, "hex", hexFormat }, + { RPMTD_FORMAT_DATE, "date", dateFormat }, + { RPMTD_FORMAT_DAY, "day", dayFormat }, + { RPMTD_FORMAT_SHESCAPE, "shescape", shescapeFormat }, + { RPMTD_FORMAT_ARRAYSIZE, "arraysize", arraysizeFormat }, + { RPMTD_FORMAT_FSTATE, "fstate", fstateFormat }, + { RPMTD_FORMAT_VFLAGS, "vflags", vflagsFormat }, + { RPMTD_FORMAT_EXPAND, "expand", expandFormat }, + { RPMTD_FORMAT_FSTATUS, "fstatus", fstatusFormat }, + { -1, NULL, NULL } +}; + headerTagFormatFunction rpmHeaderFormatFuncByName(const char *fmt) { const struct headerFormatFunc_s * ext; @@ -680,27 +702,3 @@ headerTagFormatFunction rpmHeaderFormatFuncByValue(rpmtdFormats fmt) return func; } -static const struct headerFormatFunc_s rpmHeaderFormats[] = { - { RPMTD_FORMAT_STRING, "string", stringFormat }, - { RPMTD_FORMAT_ARMOR, "armor", armorFormat }, - { RPMTD_FORMAT_BASE64, "base64", base64Format }, - { RPMTD_FORMAT_PGPSIG, "pgpsig", pgpsigFormat }, - { RPMTD_FORMAT_DEPFLAGS, "depflags", depflagsFormat }, - { RPMTD_FORMAT_DEPTYPE, "deptype", deptypeFormat }, - { RPMTD_FORMAT_FFLAGS, "fflags", fflagsFormat }, - { RPMTD_FORMAT_PERMS, "perms", permsFormat }, - { RPMTD_FORMAT_PERMS, "permissions", permsFormat }, - { RPMTD_FORMAT_TRIGGERTYPE, "triggertype", triggertypeFormat }, - { RPMTD_FORMAT_XML, "xml", xmlFormat }, - { RPMTD_FORMAT_OCTAL, "octal", octalFormat }, - { RPMTD_FORMAT_HEX, "hex", hexFormat }, - { RPMTD_FORMAT_DATE, "date", dateFormat }, - { RPMTD_FORMAT_DAY, "day", dayFormat }, - { RPMTD_FORMAT_SHESCAPE, "shescape", shescapeFormat }, - { RPMTD_FORMAT_ARRAYSIZE, "arraysize", arraysizeFormat }, - { RPMTD_FORMAT_FSTATE, "fstate", fstateFormat }, - { RPMTD_FORMAT_VFLAGS, "vflags", vflagsFormat }, - { RPMTD_FORMAT_EXPAND, "expand", expandFormat }, - { RPMTD_FORMAT_FSTATUS, "fstatus", fstatusFormat }, - { -1, NULL, NULL } -};