Changeset 1215


Ignore:
Timestamp:
Aug 14, 2003, 4:38:29 PM (17 years ago)
Author:
pooh
Message:
  • Memory-related bugs fixed.
Location:
to-imperative/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/library/StdIO/read_m_line.cc

    r1172 r1215  
    3030      n = getline(&p, &cnt, fp);
    3131      if (n != -1) {
    32         if (p[n - 1] == '\n') p[n - 1] = 0;
     32        if ((n > 0) && (p[n - 1] == '\n')) p[n - 1] = 0;
    3333        _line = Char::create_expr(p);
    3434        free(p);
  • to-imperative/trunk/runtime/rf_channel.ih

    r1156 r1215  
    6060inline bool Channel::open (char const* _fname, char const* _mode)
    6161{
    62   if (fp != 0) fclose(fp);
     62  if (fp != null) fclose(fp);
    6363  fp = fopen(_fname, _mode);
    6464  return fp != null ? true : false;
     
    6767inline void Channel::close ()
    6868{
    69   if (fp != 0) fclose(fp);
     69  if (fp != null) fclose(fp);
     70  fp = null;
    7071}
    7172
Note: See TracChangeset for help on using the changeset viewer.