diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2018-11-21 10:52:29 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2018-11-21 10:53:30 -0800 |
commit | 3fe110d31a0e5cbae54c5404df06400c817fe350 (patch) | |
tree | 29ad62a6279c5366dadaa5aa6d2d906c0eb48b3c /lib-src/emacsclient.c | |
parent | 7a85a40ef402460eafe3254df4f916369829ea21 (diff) | |
download | emacs-3fe110d31a0e5cbae54c5404df06400c817fe350.tar.gz emacs-3fe110d31a0e5cbae54c5404df06400c817fe350.tar.bz2 emacs-3fe110d31a0e5cbae54c5404df06400c817fe350.zip |
emacsclient: improve use of locals
* lib-src/emacsclient.c (main):
Use smaller scopes for some locals.
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r-- | lib-src/emacsclient.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index e3e1d9b16d3..eb128bc6e57 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1610,7 +1610,6 @@ main (int argc, char **argv) { int rl = 0; bool skiplf = true; - char *cwd, *str; char string[BUFSIZ+1]; int exit_status = EXIT_SUCCESS; @@ -1660,7 +1659,7 @@ main (int argc, char **argv) start_daemon_and_retry_set_socket (); } - cwd = get_current_dir_name (); + char *cwd = get_current_dir_name (); if (cwd == 0) { message (true, "%s: %s\n", progname, @@ -1803,10 +1802,10 @@ main (int argc, char **argv) else if (eval) { /* Read expressions interactively. */ - while ((str = fgets (string, BUFSIZ, stdin))) + while (fgets (string, BUFSIZ, stdin)) { send_to_emacs (emacs_socket, "-eval "); - quote_argument (emacs_socket, str); + quote_argument (emacs_socket, string); } send_to_emacs (emacs_socket, " "); } @@ -1876,7 +1875,7 @@ main (int argc, char **argv) /* -print STRING: Print STRING on the terminal. */ if (!suppress_output) { - str = unquote_argument (p + strlen ("-print ")); + char *str = unquote_argument (p + strlen ("-print ")); printf (&"\n%s"[skiplf], str); if (str[0]) skiplf = str[strlen (str) - 1] == '\n'; @@ -1888,7 +1887,7 @@ main (int argc, char **argv) Used to continue a preceding -print command. */ if (!suppress_output) { - str = unquote_argument (p + strlen ("-print-nonl ")); + char *str = unquote_argument (p + strlen ("-print-nonl ")); printf ("%s", str); if (str[0]) skiplf = str[strlen (str) - 1] == '\n'; @@ -1897,7 +1896,7 @@ main (int argc, char **argv) else if (strprefix ("-error ", p)) { /* -error DESCRIPTION: Signal an error on the terminal. */ - str = unquote_argument (p + strlen ("-error ")); + char *str = unquote_argument (p + strlen ("-error ")); if (!skiplf) printf ("\n"); fprintf (stderr, "*ERROR*: %s", str); |