diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2014-03-23 20:38:46 +0100 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2014-03-24 10:23:57 +0100 |
commit | 46ee8dd01fc8c8b8d4c1e5e28f7ec549bba489d0 (patch) | |
tree | 27fc1cc3a9d3fbf4509c6358dbeba06377e167be /src | |
parent | 1788f077d4ce9fb3481321d7d5c45a5b2ceb5704 (diff) | |
download | ratpoison-46ee8dd01fc8c8b8d4c1e5e28f7ec549bba489d0.zip |
Factorize code in cmd_fdump.
Diffstat (limited to 'src')
-rw-r--r-- | src/actions.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/actions.c b/src/actions.c index 887322e..d755e02 100644 --- a/src/actions.c +++ b/src/actions.c @@ -4951,13 +4951,12 @@ fdump (rp_screen *screen) cmdret * cmd_fdump (int interactively UNUSED, struct cmdarg **args) { + rp_screen *screen; + cmdret *ret; + char *dump; + if (args[0] == NULL) - { - char *s = fdump (current_screen()); - cmdret *ret = cmdret_new (RET_SUCCESS, "%s", s); - free (s); - return ret; - } + screen = current_screen (); else { int snum; @@ -4968,13 +4967,14 @@ cmd_fdump (int interactively UNUSED, struct cmdarg **args) else if (num_screens <= snum) return cmdret_new (RET_FAILURE, "fdump: unknown screen"); else - { - char *s = fdump (&screens[snum]); - cmdret *ret = cmdret_new (RET_SUCCESS, "%s", s); - free (s); - return ret; - } + screen = &screens[snum]; } + + dump = fdump (screen); + ret = cmdret_new (RET_SUCCESS, "%s", dump); + free (dump); + + return ret; } static cmdret * |