This revision was automatically updated to reflect the committed changes.
Closed by commit rG51117e3c5175: [lldb][NFC] Remove unused custom 
reimplementation of realpath for Windows (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85633/new/

https://reviews.llvm.org/D85633

Files:
  lldb/include/lldb/Host/windows/PosixApi.h
  lldb/source/Host/windows/Windows.cpp

Index: lldb/source/Host/windows/Windows.cpp
===================================================================
--- lldb/source/Host/windows/Windows.cpp
+++ lldb/source/Host/windows/Windows.cpp
@@ -82,89 +82,6 @@
   return const_cast<char *>(s);
 }
 
-char *realpath(const char *name, char *resolved) {
-  char *retname = NULL;
-
-  /* SUSv3 says we must set `errno = EINVAL', and return NULL,
-  * if `name' is passed as a NULL pointer.
-  */
-  if (name == NULL) {
-    errno = EINVAL;
-    return NULL;
-  }
-
-  /* Otherwise, `name' must refer to a readable filesystem object,
-  * if we are going to resolve its absolute path name.
-  */
-  wchar_t wideNameBuffer[PATH_MAX];
-  wchar_t *wideName = wideNameBuffer;
-  if (!utf8ToWide(name, wideName, PATH_MAX)) {
-    errno = EINVAL;
-    return NULL;
-  }
-
-  if (_waccess(wideName, 4) != 0)
-    return NULL;
-
-  /* If `name' didn't point to an existing entity,
-  * then we don't get to here; we simply fall past this block,
-  * returning NULL, with `errno' appropriately set by `access'.
-  *
-  * When we _do_ get to here, then we can use `_fullpath' to
-  * resolve the full path for `name' into `resolved', but first,
-  * check that we have a suitable buffer, in which to return it.
-  */
-
-  if ((retname = resolved) == NULL) {
-    /* Caller didn't give us a buffer, so we'll exercise the
-    * option granted by SUSv3, and allocate one.
-    *
-    * `_fullpath' would do this for us, but it uses `malloc', and
-    * Microsoft's implementation doesn't set `errno' on failure.
-    * If we don't do this explicitly ourselves, then we will not
-    * know if `_fullpath' fails on `malloc' failure, or for some
-    * other reason, and we want to set `errno = ENOMEM' for the
-    * `malloc' failure case.
-    */
-
-    retname = (char *)malloc(PATH_MAX);
-    if (retname == NULL) {
-      errno = ENOMEM;
-      return NULL;
-    }
-  }
-
-  /* Otherwise, when we do have a valid buffer,
-  * `_fullpath' should only fail if the path name is too long.
-  */
-
-  wchar_t wideFullPathBuffer[PATH_MAX];
-  wchar_t *wideFullPath;
-  if ((wideFullPath = _wfullpath(wideFullPathBuffer, wideName, PATH_MAX)) ==
-      NULL) {
-    errno = ENAMETOOLONG;
-    return NULL;
-  }
-
-  // Do a LongPath<->ShortPath roundtrip so that case is resolved by OS
-  // FIXME: Check for failure
-  size_t initialLength = wcslen(wideFullPath);
-  GetShortPathNameW(wideFullPath, wideNameBuffer, PATH_MAX);
-  GetLongPathNameW(wideNameBuffer, wideFullPathBuffer, initialLength + 1);
-
-  // Convert back to UTF-8
-  if (!wideToUtf8(wideFullPathBuffer, retname, PATH_MAX)) {
-    errno = EINVAL;
-    return NULL;
-  }
-
-  // Force drive to be upper case
-  if (retname[1] == ':')
-    retname[0] = toupper(retname[0]);
-
-  return retname;
-}
-
 #ifdef _MSC_VER
 
 char *basename(char *path) {
Index: lldb/include/lldb/Host/windows/PosixApi.h
===================================================================
--- lldb/include/lldb/Host/windows/PosixApi.h
+++ lldb/include/lldb/Host/windows/PosixApi.h
@@ -98,7 +98,6 @@
 // custom implementations.
 int vasprintf(char **ret, const char *fmt, va_list ap);
 char *strcasestr(const char *s, const char *find);
-char *realpath(const char *name, char *resolved);
 
 #ifdef _MSC_VER
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to