aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/sorted-doc.c
diff options
context:
space:
mode:
authorDavid J. MacKenzie1994-10-12 20:21:51 +0000
committerDavid J. MacKenzie1994-10-12 20:21:51 +0000
commit340ff9deaea2a7258d3ee1eca65487b4cd8dd305 (patch)
tree48728b1b42696e296b41072130301fc3ea627440 /lib-src/sorted-doc.c
parente2f9d9afabe51c8be7e6f4327197670b941789f2 (diff)
downloademacs-340ff9deaea2a7258d3ee1eca65487b4cd8dd305.tar.gz
emacs-340ff9deaea2a7258d3ee1eca65487b4cd8dd305.zip
Eliminate some -Wall warnings.
Diffstat (limited to 'lib-src/sorted-doc.c')
-rw-r--r--lib-src/sorted-doc.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c
index 129ce9c83b3..0ba419d4907 100644
--- a/lib-src/sorted-doc.c
+++ b/lib-src/sorted-doc.c
@@ -35,17 +35,9 @@ struct docstr /* Allocated thing for an entry. */
35}; 35};
36 36
37 37
38/* Print error message and exit. */
39
40fatal (s1, s2)
41 char *s1, *s2;
42{
43 error (s1, s2);
44 exit (1);
45}
46
47/* Print error message. `s1' is printf control string, `s2' is arg for it. */ 38/* Print error message. `s1' is printf control string, `s2' is arg for it. */
48 39
40void
49error (s1, s2) 41error (s1, s2)
50 char *s1, *s2; 42 char *s1, *s2;
51{ 43{
@@ -54,6 +46,16 @@ error (s1, s2)
54 fprintf (stderr, "\n"); 46 fprintf (stderr, "\n");
55} 47}
56 48
49/* Print error message and exit. */
50
51void
52fatal (s1, s2)
53 char *s1, *s2;
54{
55 error (s1, s2);
56 exit (1);
57}
58
57/* Like malloc but get fatal error if memory is exhausted. */ 59/* Like malloc but get fatal error if memory is exhausted. */
58 60
59char * 61char *
@@ -67,7 +69,7 @@ xmalloc (size)
67} 69}
68 70
69char * 71char *
70strsav (str) 72xstrdup (str)
71 char * str; 73 char * str;
72{ 74{
73 char *buf = xmalloc (strlen (str) + 1); 75 char *buf = xmalloc (strlen (str) + 1);
@@ -98,12 +100,12 @@ char *states[] =
98 "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET" 100 "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET"
99}; 101};
100 102
103int
101main () 104main ()
102{ 105{
103 register DOCSTR *dp = NULL; /* allocated DOCSTR */ 106 register DOCSTR *dp = NULL; /* allocated DOCSTR */
104 register LINE *lp = NULL; /* allocated line */ 107 register LINE *lp = NULL; /* allocated line */
105 register char *bp; /* ptr inside line buffer */ 108 register char *bp; /* ptr inside line buffer */
106 int notfirst = 0; /* set after read something */
107 register enum state state = WAITING; /* state at start */ 109 register enum state state = WAITING; /* state at start */
108 int cnt = 0; /* number of DOCSTRs read */ 110 int cnt = 0; /* number of DOCSTRs read */
109 111
@@ -169,7 +171,7 @@ main ()
169 else /* saving and changing state */ 171 else /* saving and changing state */
170 { 172 {
171 *bp = NUL; 173 *bp = NUL;
172 bp = strsav (buf); 174 bp = xstrdup (buf);
173 175
174 if (state == NAME_GET) 176 if (state == NAME_GET)
175 dp->name = bp; 177 dp->name = bp;