Group exported functions to end of macro.c, no functional changes

- Having the external interfaces together makes it easier to keep
  tracking of locks and all..
This commit is contained in:
Panu Matilainen 2013-05-22 10:21:04 +03:00
parent b823075695
commit acead93927
1 changed files with 33 additions and 31 deletions

View File

@ -88,28 +88,6 @@ static void popMacro(rpmMacroContext mc, const char * n);
/* =============================================================== */
void
rpmDumpMacroTable(rpmMacroContext mc, FILE * fp)
{
if (mc == NULL) mc = rpmGlobalMacroContext;
if (fp == NULL) fp = stderr;
fprintf(fp, "========================\n");
for (int i = 0; i < mc->n; i++) {
rpmMacroEntry me = mc->tab[i];
assert(me);
fprintf(fp, "%3d%c %s", me->level,
(me->used > 0 ? '=' : ':'), me->name);
if (me->opts && *me->opts)
fprintf(fp, "(%s)", me->opts);
if (me->body && *me->body)
fprintf(fp, "\t%s", me->body);
fprintf(fp, "\n");
}
fprintf(fp, _("======================== active %d empty %d\n"),
mc->n, 0);
}
/**
* Find entry in macro table.
* @param mc macro context
@ -1318,15 +1296,6 @@ static int doExpandMacros(rpmMacroContext mc, const char *src, char **target)
return rc;
}
int expandMacros(void * spec, rpmMacroContext mc, char * sbuf, size_t slen)
{
char *target = NULL;
int rc = doExpandMacros(mc, sbuf, &target);
rstrlcpy(sbuf, target, slen);
free(target);
return rc;
}
static void pushMacro(rpmMacroContext mc,
const char * n, const char * o, const char * b, int level)
{
@ -1423,6 +1392,39 @@ static void popMacro(rpmMacroContext mc, const char * n)
free(me);
}
/* External interfaces */
int expandMacros(void * spec, rpmMacroContext mc, char * sbuf, size_t slen)
{
char *target = NULL;
int rc = doExpandMacros(mc, sbuf, &target);
rstrlcpy(sbuf, target, slen);
free(target);
return rc;
}
void
rpmDumpMacroTable(rpmMacroContext mc, FILE * fp)
{
if (mc == NULL) mc = rpmGlobalMacroContext;
if (fp == NULL) fp = stderr;
fprintf(fp, "========================\n");
for (int i = 0; i < mc->n; i++) {
rpmMacroEntry me = mc->tab[i];
assert(me);
fprintf(fp, "%3d%c %s", me->level,
(me->used > 0 ? '=' : ':'), me->name);
if (me->opts && *me->opts)
fprintf(fp, "(%s)", me->opts);
if (me->body && *me->body)
fprintf(fp, "\t%s", me->body);
fprintf(fp, "\n");
}
fprintf(fp, _("======================== active %d empty %d\n"),
mc->n, 0);
}
void addMacro(rpmMacroContext mc,
const char * n, const char * o, const char * b, int level)
{