From ff938546975d416cf33466f54f80ec1b37e2693c Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 24 May 2002 05:44:10 +0000 Subject: * dtable.cc (dtable::build_fhandler_from_name): Just pass posix path along to set_name via return_and_clear_normalized_path. (dtable::build_fhandler): New method with const char * argument. (dtable::reset_unix_path_name): Eliminate. (dtable::dup_worker): Use correct build_fhandler method. * mmap.cc (mmap_record::alloc_fh): Ditto. * dtable.h (dtable::build_fhandler): New method. (dtable::reset_unix_path_name): Eliminate. * fhandler.cc (fhandler_base::set_name): Assume that unix_name has already been cmalloced. (fhandler_base::reset_unix_path_name): Eliminate. (fhandler_base::~fhandler_base): Coercion for cfree. * fhandler.h (fhandler_base::unix_path_name): Make const char *. (fhandler_base::win32_path_name): Ditto. (fhandler_base::reset_unix_path_name): Eliminate. * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Accommodate const char *ness of win32_path_name. * fhandler_socket.cc (fhandler_socket::fstat): Accommodate new set_name requirements. * path.cc (path_conv::return_and_clear_normalized_path): New method. (path_conv::clear_normalized_path): Eliminate. (path_conv::~path_conv): Ditto. (path_conv::check): Accommodate new build_fhandler method. * path.h (path_conv::~path_conv): Eliminate. (path_conv::clear_normalized_path): Ditto. (path_conv::return_and_clear_normalized_path): Declare new method. --- winsup/cygwin/path.cc | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'winsup/cygwin/path.cc') diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 9ae5df8c7..14c5d006d 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -366,20 +366,12 @@ fs_info::update (const char *win32_path) return true; } -void -path_conv::clear_normalized_path () -{ - // not thread safe - if (normalized_path) - { - cfree (normalized_path); - normalized_path = NULL; - } -} - -path_conv::~path_conv () +char * +path_conv::return_and_clear_normalized_path () { - clear_normalized_path (); + char *s = normalized_path; + normalized_path = NULL; + return s; } /* Convert an arbitrary path SRC to a pure Win32 path, suitable for @@ -520,7 +512,7 @@ path_conv::check (const char *src, unsigned opt, { /* FIXME: Calling build_fhandler here is not the right way to handle this. */ fhandler_virtual *fh = - (fhandler_virtual *) cygheap->fdtab.build_fhandler (-1, devn, path_copy, NULL, unit); + (fhandler_virtual *) cygheap->fdtab.build_fhandler (-1, devn, (const char *) path_copy, NULL, unit); int file_type = fh->exists (); switch (file_type) { @@ -731,7 +723,6 @@ out: *tail = '/'; normalized_path = cstrdup (path_copy); debug_printf ("path_copy %s", path_copy); - opt ^= PC_POSIX; } /* Deal with Windows stupidity which considers filename\. to be valid even when "filename" is not a directory. */ -- cgit v1.2.3