[hackers] [sbase] Staticise symbols || sin

From: <git_AT_suckless.org>
Date: Thu, 16 Oct 2014 13:30:57 +0200

commit 41d78c398b7788d9e8d1061df427fed2d6717d0d
Author: sin <sin_AT_2f30.org>
Date: Thu Oct 16 12:29:02 2014 +0100

    Staticise symbols

diff --git a/col.c b/col.c
index 329ce71..c06f73b 100644
--- a/col.c
+++ b/col.c
_AT_@ -80,22 +80,22 @@ struct line_str {
         int l_max_col; /* max column in the line */
 };
 
-LINE *alloc_line(void);
-void dowarn(int);
-void flush_line(LINE *);
-void flush_lines(int);
-void flush_blanks(void);
-void free_line(LINE *);
-void usage(void);
-void *xmalloc(void *, size_t);
-
-CSET last_set; /* char_set of last char printed */
-LINE *lines;
-int compress_spaces; /* if doing space -> tab conversion */
-int fine; /* if `fine' resolution (half lines) */
-int max_bufd_lines; /* max # lines to keep in memory */
-int nblank_lines; /* # blanks after last flushed line */
-int no_backspaces; /* if not to output any backspaces */
+static LINE *alloc_line(void);
+static void dowarn(int);
+static void flush_line(LINE *);
+static void flush_lines(int);
+static void flush_blanks(void);
+static void free_line(LINE *);
+static void usage(void);
+static void *xmalloc(void *, size_t);
+
+static CSET last_set; /* char_set of last char printed */
+static LINE *lines;
+static int compress_spaces; /* if doing space -> tab conversion */
+static int fine; /* if `fine' resolution (half lines) */
+static int max_bufd_lines; /* max # lines to keep in memory */
+static int nblank_lines; /* # blanks after last flushed line */
+static int no_backspaces; /* if not to output any backspaces */
 
 #define PUTC(ch) \
         if (putchar(ch) == EOF) \
_AT_@ -302,7 +302,7 @@ main(int argc, char *argv[])
         exit(0);
 }
 
-void
+static void
 flush_lines(int nflush)
 {
         LINE *l;
_AT_@ -328,7 +328,7 @@ flush_lines(int nflush)
  * is the number of half line feeds, otherwise it is the number of whole line
  * feeds.
  */
-void
+static void
 flush_blanks(void)
 {
         int half, i, nb;
_AT_@ -357,7 +357,7 @@ flush_blanks(void)
  * Write a line to stdout taking care of space to tab conversion (-h flag)
  * and character set shifts.
  */
-void
+static void
 flush_line(LINE *l)
 {
         CHAR *c, *endc;
_AT_@ -456,7 +456,7 @@ flush_line(LINE *l)
 
 static LINE *line_freelist;
 
-LINE *
+static LINE *
 alloc_line(void)
 {
         LINE *l;
_AT_@ -476,7 +476,7 @@ alloc_line(void)
         return (l);
 }
 
-void
+static void
 free_line(LINE *l)
 {
 
_AT_@ -484,7 +484,7 @@ free_line(LINE *l)
         line_freelist = l;
 }
 
-void *
+static void *
 xmalloc(void *p, size_t size)
 {
 
_AT_@ -493,13 +493,13 @@ xmalloc(void *p, size_t size)
         return (p);
 }
 
-void
+static void
 usage(void)
 {
         eprintf("usage: %s [-bfhx] [-l num]\n", argv0);
 }
 
-void
+static void
 dowarn(int line)
 {
         warnx("warning: can't back up %s",
diff --git a/csplit.c b/csplit.c
index f03ea79..cf9f902 100644
--- a/csplit.c
+++ b/csplit.c
_AT_@ -61,36 +61,36 @@
 
 #include "util.h"
 
-void cleanup(void);
-void do_lineno(const char *);
-void do_rexp(const char *);
-char *get_line(void);
-void handlesig(int);
-FILE *newfile(void);
-void toomuch(FILE *, long);
-void usage(void);
+static void cleanup(void);
+static void do_lineno(const char *);
+static void do_rexp(const char *);
+static char *get_line(void);
+static void handlesig(int);
+static FILE *newfile(void);
+static void toomuch(FILE *, long);
+static void usage(void);
 
 /*
  * Command line options
  */
-const char *prefix; /* File name prefix */
-long sufflen; /* Number of decimal digits for suffix */
-int sflag; /* Suppress output of file names */
-int kflag; /* Keep output if error occurs */
+static const char *prefix; /* File name prefix */
+static long sufflen; /* Number of decimal digits for suffix */
+static int sflag; /* Suppress output of file names */
+static int kflag; /* Keep output if error occurs */
 
 /*
  * Other miscellaneous globals (XXX too many)
  */
-long lineno; /* Current line number in input file */
-long reps; /* Number of repetitions for this pattern */
-long nfiles; /* Number of files output so far */
-long maxfiles; /* Maximum number of files we can create */
-char currfile[PATH_MAX]; /* Current output file */
-const char *infn; /* Name of the input file */
-FILE *infile; /* Input file handle */
-FILE *overfile; /* Overflow file for toomuch() */
-off_t truncofs; /* Offset this file should be truncated at */
-int doclean; /* Should cleanup() remove output? */
+static long lineno; /* Current line number in input file */
+static long reps; /* Number of repetitions for this pattern */
+static long nfiles; /* Number of files output so far */
+static long maxfiles; /* Maximum number of files we can create */
+static char currfile[PATH_MAX]; /* Current output file */
+static const char *infn; /* Name of the input file */
+static FILE *infile; /* Input file handle */
+static FILE *overfile; /* Overflow file for toomuch() */
+static off_t truncofs; /* Offset this file should be truncated at */
+static int doclean; /* Should cleanup() remove output? */
 
 int
 main(int argc, char *argv[])
_AT_@ -199,14 +199,14 @@ main(int argc, char *argv[])
         return (0);
 }
 
-void
+static void
 usage(void)
 {
         eprintf("usage: %s [-ks] [-f prefix] [-n number] file args ...\n", argv0);
 }
 
 /* ARGSUSED */
-void
+static void
 handlesig(int sig)
 {
         const char msg[] = "csplit: caught signal, cleaning up\n";
_AT_@ -217,7 +217,7 @@ handlesig(int sig)
 }
 
 /* Create a new output file. */
-FILE *
+static FILE *
 newfile(void)
 {
         FILE *fp;
_AT_@ -233,7 +233,7 @@ newfile(void)
 }
 
 /* Remove partial output, called before exiting. */
-void
+static void
 cleanup(void)
 {
         char fnbuf[PATH_MAX];
_AT_@ -254,7 +254,7 @@ cleanup(void)
 }
 
 /* Read a line from the input into a static buffer. */
-char *
+static char *
 get_line(void)
 {
         static char lbuf[LINE_MAX];
_AT_@ -277,7 +277,7 @@ again: if (fgets(lbuf, sizeof(lbuf), src) == NULL) {
 }
 
 /* Conceptually rewind the input (as obtained by get_line()) back `n' lines. */
-void
+static void
 toomuch(FILE *ofp, long n)
 {
         char buf[BUFSIZ];
_AT_@ -336,7 +336,7 @@ toomuch(FILE *ofp, long n)
 }
 
 /* Handle splits for /regexp/ and %regexp% patterns. */
-void
+static void
 do_rexp(const char *expr)
 {
         regex_t cre;
_AT_@ -418,7 +418,7 @@ do_rexp(const char *expr)
 }
 
 /* Handle splits based on line number. */
-void
+static void
 do_lineno(const char *expr)
 {
         long lastline, tgtline;
diff --git a/expr.c b/expr.c
index 68220fb..9457d39 100644
--- a/expr.c
+++ b/expr.c
_AT_@ -15,22 +15,22 @@
 #include <regex.h>
 #include <err.h>
 
-struct val *make_int(int);
-struct val *make_str(char *);
-void free_value(struct val *);
-int is_integer(struct val *, int *);
-int to_integer(struct val *);
-void to_string(struct val *);
-int is_zero_or_null(struct val *);
-void nexttoken(int);
-void error(void);
-struct val *eval6(void);
-struct val *eval5(void);
-struct val *eval4(void);
-struct val *eval3(void);
-struct val *eval2(void);
-struct val *eval1(void);
-struct val *eval0(void);
+static struct val *make_int(int);
+static struct val *make_str(char *);
+static void free_value(struct val *);
+static int is_integer(struct val *, int *);
+static int to_integer(struct val *);
+static void to_string(struct val *);
+static int is_zero_or_null(struct val *);
+static void nexttoken(int);
+static void error(void);
+static struct val *eval6(void);
+static struct val *eval5(void);
+static struct val *eval4(void);
+static struct val *eval3(void);
+static struct val *eval2(void);
+static struct val *eval1(void);
+static struct val *eval0(void);
 
 enum token {
         OR, AND, EQ, LT, GT, ADD, SUB, MUL, DIV, MOD, MATCH, RP, LP,
_AT_@ -49,11 +49,11 @@ struct val {
         } u;
 };
 
-enum token token;
-struct val *tokval;
-char **av;
+static enum token token;
+static struct val *tokval;
+static char **av;
 
-struct val *
+static struct val *
 make_int(int i)
 {
         struct val *vp;
_AT_@ -67,8 +67,7 @@ make_int(int i)
         return vp;
 }
 
-
-struct val *
+static struct val *
 make_str(char *s)
 {
         struct val *vp;
_AT_@ -81,8 +80,7 @@ make_str(char *s)
         return vp;
 }
 
-
-void
+static void
 free_value(struct val *vp)
 {
         if (vp->type == string)
_AT_@ -90,9 +88,8 @@ free_value(struct val *vp)
         free(vp);
 }
 
-
 /* determine if vp is an integer; if so, return it's value in *r */
-int
+static int
 is_integer(struct val *vp, int *r)
 {
         char *s;
_AT_@ -132,9 +129,8 @@ is_integer(struct val *vp, int *r)
         return 1;
 }
 
-
 /* coerce to vp to an integer */
-int
+static int
 to_integer(struct val *vp)
 {
         int r;
_AT_@ -152,9 +148,8 @@ to_integer(struct val *vp)
         return 0;
 }
 
-
 /* coerce to vp to an string */
-void
+static void
 to_string(struct val *vp)
 {
         char *tmp;
_AT_@ -169,7 +164,7 @@ to_string(struct val *vp)
         vp->u.s = tmp;
 }
 
-int
+static int
 is_zero_or_null(struct val *vp)
 {
         if (vp->type == integer) {
_AT_@ -180,7 +175,7 @@ is_zero_or_null(struct val *vp)
         /* NOTREACHED */
 }
 
-void
+static void
 nexttoken(int pat)
 {
         char *p;
_AT_@ -219,14 +214,14 @@ nexttoken(int pat)
         return;
 }
 
-void
+static void
 error(void)
 {
         errx(2, "syntax error");
         /* NOTREACHED */
 }
 
-struct val *
+static struct val *
 eval6(void)
 {
         struct val *v;
_AT_@ -253,7 +248,7 @@ eval6(void)
 }
 
 /* Parse and evaluate match (regex) expressions */
-struct val *
+static struct val *
 eval5(void)
 {
         regex_t rp;
_AT_@ -308,7 +303,7 @@ eval5(void)
 }
 
 /* Parse and evaluate multiplication and division expressions */
-struct val *
+static struct val *
 eval4(void)
 {
         struct val *l, *r;
_AT_@ -347,7 +342,7 @@ eval4(void)
 }
 
 /* Parse and evaluate addition and subtraction expressions */
-struct val *
+static struct val *
 eval3(void)
 {
         struct val *l, *r;
_AT_@ -375,7 +370,7 @@ eval3(void)
 }
 
 /* Parse and evaluate comparison expressions */
-struct val *
+static struct val *
 eval2(void)
 {
         struct val *l, *r;
_AT_@ -448,7 +443,7 @@ eval2(void)
 }
 
 /* Parse and evaluate & expressions */
-struct val *
+static struct val *
 eval1(void)
 {
         struct val *l, *r;
_AT_@ -471,7 +466,7 @@ eval1(void)
 }
 
 /* Parse and evaluate | expressions */
-struct val *
+static struct val *
 eval0(void)
 {
         struct val *l, *r;
Received on Thu Oct 16 2014 - 13:30:57 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 16 2014 - 13:36:09 CEST