Mercurial > emacs
comparison lib-src/yow.c @ 49802:dc31cb80909b
(yow): Cast result of malloc and realloc.
(malloc, realloc): Declarations deleted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 15 Feb 2003 10:52:52 +0000 |
parents | 23a1cea22d13 |
children | 695cf19ef79e |
comparison
equal
deleted
inserted
replaced
49801:2f5914b4e18a | 49802:dc31cb80909b |
---|---|
46 p = res + strlen (res);\ | 46 p = res + strlen (res);\ |
47 while (p != res && *p != '/' && *p != '\\' && *p != ':') p--;\ | 47 while (p != res && *p != '/' && *p != '\\' && *p != ':') p--;\ |
48 strcpy (p + 1, "../");\ | 48 strcpy (p + 1, "../");\ |
49 strcpy (p + 4, rel);\ | 49 strcpy (p + 4, rel);\ |
50 &res;}) | 50 &res;}) |
51 #endif | |
52 | |
53 #ifndef HAVE_STDLIB_H | |
54 char *malloc __P ((size_t size))), *realloc __P ((POINTER_TYPE *ptr, size_t size)); | |
55 #endif | 51 #endif |
56 | 52 |
57 void yow(); | 53 void yow(); |
58 void setup_yow(); | 54 void setup_yow(); |
59 | 55 |
156 yow(fp); | 152 yow(fp); |
157 return; | 153 return; |
158 } | 154 } |
159 | 155 |
160 bufsize = BUFSIZE; | 156 bufsize = BUFSIZE; |
161 buf = malloc(bufsize); | 157 buf = (char *) malloc(bufsize); |
162 if (buf == (char *)0) { | 158 if (buf == (char *)0) { |
163 fprintf(stderr, "yow: virtual memory exhausted\n"); | 159 fprintf(stderr, "yow: virtual memory exhausted\n"); |
164 exit (3); | 160 exit (3); |
165 } | 161 } |
166 | 162 |
169 buf[i++] = c; | 165 buf[i++] = c; |
170 | 166 |
171 if (i == bufsize-1) { | 167 if (i == bufsize-1) { |
172 /* Yow! Is this quotation too long yet? */ | 168 /* Yow! Is this quotation too long yet? */ |
173 bufsize *= 2; | 169 bufsize *= 2; |
174 buf = realloc(buf, bufsize); | 170 buf = (char *) realloc(buf, bufsize); |
175 if (buf == (char *)0) { | 171 if (buf == (char *)0) { |
176 fprintf(stderr, "yow: virtual memory exhausted\n"); | 172 fprintf(stderr, "yow: virtual memory exhausted\n"); |
177 exit (3); | 173 exit (3); |
178 } | 174 } |
179 } | 175 } |