Changeset 1186


Ignore:
Timestamp:
Aug 13, 2003, 9:42:46 AM (17 years ago)
Author:
pooh
Message:
  • Open-File() fixes.
File:
1 edited

Legend:

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

    r1170 r1186  
    33#include <stdio.h>
    44#include <errno.h>
     5#include <ctype.h>
    56
    67using namespace rfrt;
     
    2122      Word::create_expr(L"Invalid filename");
    2223  }
    23   char* fname = new char[len + 1];
     24  char* fname = static_cast<char*>(alloca(len + 1));
    2425  wcstombs(fname, ws.get_data(), len + 1);
    2526  fname[len] = 0;
     
    3738              Word::create_expr(L"Invalid mode");
    3839          }
    39           char* mode = new char[len + 1];
     40          char* mode = static_cast<char*>(alloca(len + 1));
    4041          wcstombs(mode, ws.get_data(), len + 1);
    4142          mode[len] = 0;
    4243          mode[0] = tolower(mode[0]);
    4344          bool res = ch->open(fname, mode);
    44           delete mode;
    45           delete fname;
    4645          if (!res) retfail;
    4746          return true;
Note: See TracChangeset for help on using the changeset viewer.