Ignore:
Timestamp:
1999-10-18T12:43:31+13:00 (25 years ago)
Author:
cs025
Message:

Changes to eradicate Xmalloc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/mgpp/text/read_line.cpp

    r655 r711  
    8383static void memory_error_and_abort ();
    8484
    85 char *
    86 xmalloc (bytes)
    87      int bytes;
    88 {
    89   char *temp = (char *) Xmalloc (bytes);
     85void *
     86xmalloc (size_t bytes)
     87{
     88  void *temp = Xmalloc (bytes);
    9089
    9190  if (!temp)
     
    9493}
    9594
    96 char *
    97 xrealloc (pointer, bytes)
    98      char *pointer;
    99      int bytes;
    100 {
    101   char *temp;
     95void *
     96xrealloc (void *pointer, size_t bytes)
     97{
     98  void *temp;
    10299
    103100  if (!pointer)
    104     temp = (char *) xmalloc (bytes);
     101    temp = xmalloc (bytes);
    105102  else
    106     temp = (char *) Xrealloc (pointer, bytes);
     103    temp = Xrealloc (pointer, bytes);
    107104
    108105  if (!temp)
     
    150147  static char *the_line = NULL;
    151148  if (the_line)
    152     Xfree (the_line);
     149    delete the_line;
    153150  the_line = NULL;
    154151  rl_instream = InFile;
     
    194191  char *s;
    195192  if (line)
    196     Xfree (line);
     193    delete line;
    197194  line = NULL;
     195
    198196  if (!(s = GetLine ("> ")))
    199197    return (NULL);
     
    210208      if (!(s = GetLine ("? ")))
    211209    return (NULL);
    212       if (!(newline = (char *) Xmalloc (strlen (line) + strlen (s) + 2)))
     210      if (!(newline = new char[strlen (line) + strlen (s) + 2]))
    213211    {
    214212      fprintf (stderr, "Unable to allocate memory for the line\n");
     
    218216      strcat (newline, "\n");
    219217      strcat (newline, s);
    220       Xfree (line);
     218      delete line;
    221219      line = newline;
    222220    }
Note: See TracChangeset for help on using the changeset viewer.