hush: unify syntax_error_unterm_{ch,str} a bit
authorMike Frysinger <vapier@gentoo.org>
Mon, 1 Jun 2009 18:14:36 +0000 (14:14 -0400)
committerMike Frysinger <vapier@gentoo.org>
Mon, 1 Jun 2009 18:16:43 +0000 (14:16 -0400)
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
shell/hush.c

index 4c45e6559bb960d1a01d495c188a8eeaab660891..e3f7b6eb7311e4ea67a5e8f3a8ebc8d4cc1b33f2 100644 (file)
@@ -771,6 +771,11 @@ static void syntax_error_at(unsigned lineno, const char *msg)
        die_if_script(lineno, "syntax error at '%s'", msg);
 }
 
+static void syntax_error_unterm_str(unsigned lineno, const char *s)
+{
+       die_if_script(lineno, "syntax error: unterminated %s", s);
+}
+
 /* It so happens that all such cases are totally fatal
  * even if shell is interactive: EOF while looking for closing
  * delimiter. There is nowhere to read stuff from after that,
@@ -779,18 +784,11 @@ static void syntax_error_at(unsigned lineno, const char *msg)
 static void syntax_error_unterm_ch(unsigned lineno, char ch) NORETURN;
 static void syntax_error_unterm_ch(unsigned lineno, char ch)
 {
-       char msg[2];
-       msg[0] = ch;
-       msg[1] = '\0';
-       die_if_script(lineno, "syntax error: unterminated %s", msg);
+       char msg[2] = { ch, '\0' };
+       syntax_error_unterm_str(lineno, msg);
        xfunc_die();
 }
 
-static void syntax_error_unterm_str(unsigned lineno, const char *s)
-{
-       die_if_script(lineno, "syntax error: unterminated %s", s);
-}
-
 static void syntax_error_unexpected_ch(unsigned lineno, int ch)
 {
        char msg[2];