comparison lib-src/cvtmail.c @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 84b14dcb0985
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
39 39
40 #include <stdio.h> 40 #include <stdio.h>
41 #include <string.h> 41 #include <string.h>
42 #include <stdlib.h> 42 #include <stdlib.h>
43 43
44 static void *xmalloc (unsigned int); 44 static void *xmalloc (size_t);
45 static void *xrealloc (char *ptr, unsigned int); 45 static void *xrealloc (void *, size_t);
46 static void skip_to_lf (FILE *stream); 46 static void skip_to_lf (FILE *stream);
47 static void fatal (CONST char *s1, CONST char *s2); 47 static void fatal (CONST char *s1, CONST char *s2);
48 static void error (CONST char *s1, CONST char *s2); 48 static void error (CONST char *s1, CONST char *s2);
49 49
50 int 50 int
109 fclose (mfilef); 109 fclose (mfilef);
110 return 0; 110 return 0;
111 } 111 }
112 112
113 static void 113 static void
114 skip_to_lf (stream) 114 skip_to_lf (FILE *stream)
115 FILE *stream;
116 { 115 {
117 register int c; 116 register int c;
118 while ((c = getc(stream)) != '\n') 117 while ((c = getc(stream)) != '\n')
119 ; 118 ;
120 } 119 }
121 120
122 static void * 121 static void *
123 xmalloc (size) 122 xmalloc (size_t size)
124 unsigned size;
125 { 123 {
126 char *result = (char *) malloc (size); 124 void *result = malloc (size);
127 if (!result) 125 if (!result)
128 fatal ("virtual memory exhausted", 0); 126 fatal ("virtual memory exhausted", 0);
129 return result; 127 return result;
130 } 128 }
131 129
132 static void * 130 static void *
133 xrealloc (ptr, size) 131 xrealloc (void *ptr, size_t size)
134 char *ptr;
135 unsigned size;
136 { 132 {
137 char *result = (char *) realloc (ptr, size); 133 void *result = realloc (ptr, size);
138 if (!result) 134 if (!result)
139 fatal ("virtual memory exhausted", 0); 135 fatal ("virtual memory exhausted", 0);
140 return result; 136 return result;
141 } 137 }
142 138