On Jan 15 14:45, Ben Wijen wrote:
> The _remove_r code is already in the remove function.
> Therefore, just call the remove function and make
> sure errno is set correctly in the reent struct.
> ---
>  winsup/cygwin/syscalls.cc | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
> index ce4e9c65c..0e89b4f44 100644
> --- a/winsup/cygwin/syscalls.cc
> +++ b/winsup/cygwin/syscalls.cc
> @@ -1133,18 +1133,15 @@ unlink (const char *ourname)
>  }
>  
>  extern "C" int
> -_remove_r (struct _reent *, const char *ourname)
> +_remove_r (struct _reent *ptr, const char *ourname)
>  {
> -  path_conv win32_name (ourname, PC_SYM_NOFOLLOW);
> +  int ret;
>  
> -  if (win32_name.error)
> -    {
> -      set_errno (win32_name.error);
> -      syscall_printf ("%R = remove(%s)",-1, ourname);
> -      return -1;
> -    }
> +  errno = 0;
> +  if ((ret = remove (ourname)) == -1 && errno != 0)
> +    ptr->_errno = errno;
>  
> -  return win32_name.isdir () ? rmdir (ourname) : unlink (ourname);
> +  return ret;
>  }

Hmm, you're adding another function call to the call stack.  Doesn't
that slow down _remove_r rather than speeding it up?  Ok, this function
is called from _tmpfile_r/_tmpfile64_r only, so dedup may trump speed
here...

What's your stance?


Thanks,
Corinna

Reply via email to