Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-09-05 07:16:28 +0400
committerChristopher Faylor <me@cgf.cx>2000-09-05 07:16:28 +0400
commit7e24f1bf3a75f4579cd6b39c87a9f1fb6e79d988 (patch)
treedec7952fa25b5afaaa1fdf9cf7761efb58bb3135 /winsup/cygwin/cygheap.cc
parent108952ea1d506272bc197e51cf1c4dd7e3bf96eb (diff)
* path.cc (cwd_win32): Eliminate.
(cwd_posix): Eliminate. (cwd_hash): Eliminate. (cwdstuff::init): Rename from cwd_init. (cwdstuff::fixup_after_exec): Rename from cwd_fixup_after_exec. (cwdstuff::get): Rename from get_cwd_inner. (normalize_posix_path): Eliminate cwd argument. Just calculate when necessary. (normalize_win32_path): Ditto. (mount_info::conv_to_win32_path): Eliminate cwd retrieval here. (mount_info::conv_to_posix_path): Ditto. (hash_path_name): Accomodate additional methods in cwdstuff. (get_cwd_win32): Eliminate. (getcwd): Use cwdstuff methods. Properly handle case where buf == NULL and len < 0. (cwdstuff::get_hash): New method. (cwdstuff::get_initial): New method. (cwdstuff::set): New method. (cwdstuff::get): New method. (cwdstuff::copy): New method. * path.h: Move cwdstuff struct here. Add a bunch of stuff to cwdstuff. Make cygcwd an extern. * spawn.cc (spawn_guts): Use copy method to get copies of cwd info to pass to execed process. * dcrt0.cc (dll_crt0_1): Use cygcwd methods for cwd initialization.
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r--winsup/cygwin/cygheap.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 157c7e478..09bd680bf 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -111,13 +111,18 @@ _cfree (void *ptr)
static void *__stdcall
_crealloc (void *ptr, int size)
{
- char *newptr;
- int oldsize = bucket2size[*(int *) ((char *) ptr - 4)];
- if (size <= oldsize)
- return ptr;
- newptr = (char *) _cmalloc (size);
- memcpy (newptr, ptr, oldsize);
- _cfree (ptr);
+ void *newptr;
+ if (ptr == NULL)
+ newptr = _cmalloc (size);
+ else
+ {
+ int oldsize = bucket2size[*(int *) ((char *) ptr - 4)];
+ if (size <= oldsize)
+ return ptr;
+ newptr = _cmalloc (size);
+ memcpy (newptr, ptr, oldsize);
+ _cfree (ptr);
+ }
return newptr;
}