]> git.itanic.dy.fi Git - glucose/commitdiff
main.c: Remove forward declaration for token()
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Tue, 27 Mar 2012 16:42:00 +0000 (19:42 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Tue, 27 Mar 2012 16:42:00 +0000 (19:42 +0300)
The forward declaration can be avoided by moving the function before
any call sites. As an added bonus, the function is marked as static as
it is not used in any other C file.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
main.c

diff --git a/main.c b/main.c
index d1b586c343c8bd1ac06e4407aca4eb9764221970..aa1c0e24d500bbbc8ecf167d5df41657cdfc4956 100644 (file)
--- a/main.c
+++ b/main.c
 #include "options.h"
 #include "contour-protocol.h"
 
 #include "options.h"
 #include "contour-protocol.h"
 
-char *token(char **str, char sep);
+static char *token(char **str, char sep)
+{
+       char *start = *str;
+       char *cur;
+
+       for (cur = start; *cur && (*cur != sep); ++cur);
+
+       *cur = 0;
+       *str = cur+1;
+
+       return start;
+}
 
 int main(int argc, char *argv[])
 {
 
 int main(int argc, char *argv[])
 {
@@ -118,13 +129,3 @@ int main(int argc, char *argv[])
 
        return 0;
 }
 
        return 0;
 }
-
-char *token(char **str, char sep)
-{
-  char *start = *str;
-  char *cur;
-  for ( cur = start; *cur && (*cur != sep); ++cur ) ;
-  *cur = 0;
-  *str = cur+1;
-  return start;
-}