summaryrefslogtreecommitdiff
path: root/src/common/compat.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-27 12:15:22 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-27 12:30:11 -0400
commit3246c114a20da44064f7fae8eb6b6712e708a700 (patch)
tree1138f123a4e4b3086cdb6b36bfdf2e58c630f8e2 /src/common/compat.c
parent356f59b1bd66dc1db44e438846aaf431381743db (diff)
downloadtor-3246c114a20da44064f7fae8eb6b6712e708a700.tar.gz
tor-3246c114a20da44064f7fae8eb6b6712e708a700.zip
Move format_win32_error into lib/log/
Diffstat (limited to 'src/common/compat.c')
-rw-r--r--src/common/compat.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 9cc0b4f040..b462ee1b4c 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -1934,51 +1934,6 @@ network_init(void)
return 0;
}
-#ifdef _WIN32
-/** Return a newly allocated string describing the windows system error code
- * <b>err</b>. Note that error codes are different from errno. Error codes
- * come from GetLastError() when a winapi call fails. errno is set only when
- * ANSI functions fail. Whee. */
-char *
-format_win32_error(DWORD err)
-{
- TCHAR *str = NULL;
- char *result;
- DWORD n;
-
- /* Somebody once decided that this interface was better than strerror(). */
- n = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, err,
- MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
- (LPVOID)&str,
- 0, NULL);
-
- if (str && n) {
-#ifdef UNICODE
- size_t len;
- if (n > 128*1024)
- len = (128 * 1024) * 2 + 1; /* This shouldn't be possible, but let's
- * make sure. */
- else
- len = n * 2 + 1;
- result = tor_malloc(len);
- wcstombs(result,str,len);
- result[len-1] = '\0';
-#else /* !(defined(UNICODE)) */
- result = tor_strdup(str);
-#endif /* defined(UNICODE) */
- } else {
- result = tor_strdup("<unformattable error>");
- }
- if (str) {
- LocalFree(str); /* LocalFree != free() */
- }
- return result;
-}
-#endif /* defined(_WIN32) */
-
#if defined(HW_PHYSMEM64)
/* This appears to be an OpenBSD thing */
#define INT64_HW_MEM HW_PHYSMEM64