mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-27 23:22:09 +00:00
DEV: flags: remove the now useless intermediary functions
There's no more point keeping functions that are just wrappers around other ones, let's directly call them from the main entry point. It helps visually control the mapping between output formats and their definition and doesn't require to invent long names. For a bit more readability, the tmpbuf and its size adopted slightly shorter names.
This commit is contained in:
parent
a8db91ffa2
commit
cdefa80e6c
@ -24,7 +24,8 @@
|
||||
const char *show_as_words[] = { "ana", "chn", "conn", "sc", "stet", "strm", "task", "txn", "sd", };
|
||||
|
||||
/* will be sufficient for even largest flag names */
|
||||
static char tmpbuf[4096];
|
||||
static char buf[4096];
|
||||
static size_t bsz = sizeof(buf);
|
||||
|
||||
unsigned int get_show_as(const char *word)
|
||||
{
|
||||
@ -39,61 +40,6 @@ unsigned int get_show_as(const char *word)
|
||||
}
|
||||
}
|
||||
|
||||
void show_chn_ana(unsigned int f)
|
||||
{
|
||||
chn_show_analysers(tmpbuf, sizeof(tmpbuf), " | ", f);
|
||||
printf("chn->ana = %s\n", tmpbuf);
|
||||
}
|
||||
|
||||
void show_chn_flags(unsigned int f)
|
||||
{
|
||||
chn_show_flags(tmpbuf, sizeof(tmpbuf), " | ", f);
|
||||
printf("chn->flags = %s\n", tmpbuf);
|
||||
}
|
||||
|
||||
void show_conn_flags(unsigned int f)
|
||||
{
|
||||
conn_show_flags(tmpbuf, sizeof(tmpbuf), " | ", f);
|
||||
printf("conn->flags = %s\n", tmpbuf);
|
||||
}
|
||||
|
||||
void show_sd_flags(unsigned int f)
|
||||
{
|
||||
se_show_flags(tmpbuf, sizeof(tmpbuf), " | ", f);
|
||||
printf("sd->flags = %s\n", tmpbuf);
|
||||
}
|
||||
|
||||
void show_sc_flags(unsigned int f)
|
||||
{
|
||||
sc_show_flags(tmpbuf, sizeof(tmpbuf), " | ", f);
|
||||
printf("sc->flags = %s\n", tmpbuf);
|
||||
}
|
||||
|
||||
void show_strm_et(unsigned int f)
|
||||
{
|
||||
strm_et_show_flags(tmpbuf, sizeof(tmpbuf), " | ", f);
|
||||
printf("strm->et = %s\n", tmpbuf);
|
||||
}
|
||||
|
||||
void show_task_state(unsigned int f)
|
||||
{
|
||||
task_show_state(tmpbuf, sizeof(tmpbuf), " | ", f);
|
||||
printf("task->state = %s\n", tmpbuf);
|
||||
}
|
||||
|
||||
void show_txn_flags(unsigned int f)
|
||||
{
|
||||
txn_show_flags(tmpbuf, sizeof(tmpbuf), " | ", f);
|
||||
printf("txn->flags = %s\n", tmpbuf);
|
||||
}
|
||||
|
||||
void show_strm_flags(unsigned int f)
|
||||
{
|
||||
strm_show_flags(tmpbuf, sizeof(tmpbuf), " | ", f);
|
||||
printf("strm->flags = %s\n", tmpbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
void usage_exit(const char *name)
|
||||
{
|
||||
int word, nbword;
|
||||
@ -169,15 +115,15 @@ int main(int argc, char **argv)
|
||||
if (multi || use_stdin)
|
||||
printf("### 0x%08x:\n", flags);
|
||||
|
||||
if (show_as & SHOW_AS_ANA) show_chn_ana(flags);
|
||||
if (show_as & SHOW_AS_CHN) show_chn_flags(flags);
|
||||
if (show_as & SHOW_AS_CONN) show_conn_flags(flags);
|
||||
if (show_as & SHOW_AS_SC) show_sc_flags(flags);
|
||||
if (show_as & SHOW_AS_SD) show_sd_flags(flags);
|
||||
if (show_as & SHOW_AS_SET) show_strm_et(flags);
|
||||
if (show_as & SHOW_AS_STRM) show_strm_flags(flags);
|
||||
if (show_as & SHOW_AS_TASK) show_task_state(flags);
|
||||
if (show_as & SHOW_AS_TXN) show_txn_flags(flags);
|
||||
if (show_as & SHOW_AS_ANA) printf("chn->ana = %s\n", (chn_show_analysers(buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_CHN) printf("chn->flags = %s\n", (chn_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_CONN) printf("conn->flags = %s\n", (conn_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_SC) printf("sc->flags = %s\n", (sc_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_SD) printf("sd->flags = %s\n", (se_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_SET) printf("strm->et = %s\n", (strm_et_show_flags(buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_STRM) printf("strm->flags = %s\n", (strm_show_flags (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_TASK) printf("task->state = %s\n", (task_show_state (buf, bsz, " | ", flags), buf));
|
||||
if (show_as & SHOW_AS_TXN) printf("txn->flags = %s\n", (txn_show_flags (buf, bsz, " | ", flags), buf));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user