Changeset 711 for trunk/gsdl/src/mgpp/text/read_line.cpp
- Timestamp:
- 1999-10-18T12:43:31+13:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/mgpp/text/read_line.cpp
r655 r711 83 83 static void memory_error_and_abort (); 84 84 85 char * 86 xmalloc (bytes) 87 int bytes; 88 { 89 char *temp = (char *) Xmalloc (bytes); 85 void * 86 xmalloc (size_t bytes) 87 { 88 void *temp = Xmalloc (bytes); 90 89 91 90 if (!temp) … … 94 93 } 95 94 96 char * 97 xrealloc (pointer, bytes) 98 char *pointer; 99 int bytes; 100 { 101 char *temp; 95 void * 96 xrealloc (void *pointer, size_t bytes) 97 { 98 void *temp; 102 99 103 100 if (!pointer) 104 temp = (char *)xmalloc (bytes);101 temp = xmalloc (bytes); 105 102 else 106 temp = (char *)Xrealloc (pointer, bytes);103 temp = Xrealloc (pointer, bytes); 107 104 108 105 if (!temp) … … 150 147 static char *the_line = NULL; 151 148 if (the_line) 152 Xfree (the_line);149 delete the_line; 153 150 the_line = NULL; 154 151 rl_instream = InFile; … … 194 191 char *s; 195 192 if (line) 196 Xfree (line);193 delete line; 197 194 line = NULL; 195 198 196 if (!(s = GetLine ("> "))) 199 197 return (NULL); … … 210 208 if (!(s = GetLine ("? "))) 211 209 return (NULL); 212 if (!(newline = (char *) Xmalloc (strlen (line) + strlen (s) + 2)))210 if (!(newline = new char[strlen (line) + strlen (s) + 2])) 213 211 { 214 212 fprintf (stderr, "Unable to allocate memory for the line\n"); … … 218 216 strcat (newline, "\n"); 219 217 strcat (newline, s); 220 Xfree (line);218 delete line; 221 219 line = newline; 222 220 }
Note:
See TracChangeset
for help on using the changeset viewer.