From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sa-prd-fep-042.btinternet.com (mailomta2-sa.btinternet.com [213.120.69.8]) by sourceware.org (Postfix) with ESMTPS id 83AA7396E060 for ; Thu, 2 Jun 2022 14:13:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 83AA7396E060 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dronecode.org.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=dronecode.org.uk Received: from sa-prd-rgout-002.btmx-prd.synchronoss.net ([10.2.38.5]) by sa-prd-fep-042.btinternet.com with ESMTP id <20220602141316.BLCM3231.sa-prd-fep-042.btinternet.com@sa-prd-rgout-002.btmx-prd.synchronoss.net>; Thu, 2 Jun 2022 15:13:16 +0100 Authentication-Results: btinternet.com; none X-SNCR-Rigid: 6139417C274859D6 X-Originating-IP: [86.139.167.41] X-OWM-Source-IP: 86.139.167.41 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvfedrledvgdejudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemuceutffkvffkuffjvffgnffgvefqofdpqfgfvfenuceurghilhhouhhtmecufedtudenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeflohhnucfvuhhrnhgvhicuoehjohhnrdhtuhhrnhgvhiesughrohhnvggtohguvgdrohhrghdruhhkqeenucggtffrrghtthgvrhhnpeeliedtjefhtdevkeehueegffegveeftdejjeevfefhiefffeektddvteehheeijeenucfkphepkeeirddufeelrdduieejrdegudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopehlohgtrghlhhhoshhtrdhlohgtrghlughomhgrihhnpdhinhgvthepkeeirddufeelrdduieejrdeguddpmhgrihhlfhhrohhmpehjohhnrdhtuhhrnhgvhiesughrohhnvggtohguvgdrohhrghdruhhkpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepghgusgdqphgrthgthhgvshesshhouhhrtggvfigrrhgvrdhorhhgpdhrtghpthhtohepjhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukh X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from localhost.localdomain (86.139.167.41) by sa-prd-rgout-002.btmx-prd.synchronoss.net (5.8.716.04) (authenticated as jonturney@btinternet.com) id 6139417C274859D6; Thu, 2 Jun 2022 15:13:16 +0100 From: Jon Turney To: gdb-patches@sourceware.org Cc: Jon Turney Subject: [PATCH 1/2] Simplify cygwin_buf_t Date: Thu, 2 Jun 2022 15:12:57 +0100 Message-Id: <20220602141258.18968-2-jon.turney@dronecode.org.uk> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602141258.18968-1-jon.turney@dronecode.org.uk> References: <20220602141258.18968-1-jon.turney@dronecode.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1198.7 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2022 14:13:19 -0000 Prior to c6ca3dab dropping support for Cygwin 1.5, cygwin_buf_t was defined as char_t for Cygwin 1.5. After that, it's always wchar_t, so just use that. --- gdb/nat/windows-nat.c | 3 +-- gdb/windows-nat.c | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c index ca6a529601e..20a2902b109 100644 --- a/gdb/nat/windows-nat.c +++ b/gdb/nat/windows-nat.c @@ -28,7 +28,6 @@ #else #include #define __USEWIDE -typedef wchar_t cygwin_buf_t; #define GetModuleFileNameEx GetModuleFileNameExW #endif @@ -196,7 +195,7 @@ windows_process_info::get_exec_module_filename (char *exe_name_ret, /* Cygwin prefers that the path be in /x/y/z format, so extract the filename into a temporary buffer first, and then convert it to POSIX format into the destination buffer. */ - cygwin_buf_t *pathbuf = (cygwin_buf_t *) alloca (exe_name_max_len * sizeof (cygwin_buf_t)); + wchar_t *pathbuf = (wchar_t *) alloca (exe_name_max_len * sizeof (wchar_t)); len = GetModuleFileNameEx (handle, dh_buf, pathbuf, exe_name_max_len); diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 8631a1b4569..ab438750186 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -90,7 +90,6 @@ static windows_process_info windows_process; static CORE_ADDR cygwin_load_start; static CORE_ADDR cygwin_load_end; # define __USEWIDE - typedef wchar_t cygwin_buf_t; # define STARTUPINFO STARTUPINFOW # define CreateProcess CreateProcessW #endif @@ -683,7 +682,7 @@ windows_make_so (const char *name, LPVOID load_addr) strcat (buf, "\\ntdll.dll"); } #else - cygwin_buf_t buf[__PMAX]; + wchar_t buf[__PMAX]; buf[0] = 0; if (access (name, F_OK) != 0) @@ -2340,13 +2339,13 @@ windows_nat_target::create_inferior (const char *exec_file, { STARTUPINFO si; #ifdef __CYGWIN__ - cygwin_buf_t real_path[__PMAX]; - cygwin_buf_t shell[__PMAX]; /* Path to shell */ - cygwin_buf_t infcwd[__PMAX]; + wchar_t real_path[__PMAX]; + wchar_t shell[__PMAX]; /* Path to shell */ + wchar_t infcwd[__PMAX]; const char *sh; - cygwin_buf_t *toexec; - cygwin_buf_t *cygallargs; - cygwin_buf_t *args; + wchar_t *toexec; + wchar_t *cygallargs; + wchar_t *args; char **old_env = NULL; PWCHAR w32_env; size_t len; @@ -2403,7 +2402,7 @@ windows_nat_target::create_inferior (const char *exec_file, { flags |= DEBUG_ONLY_THIS_PROCESS; if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, exec_file, real_path, - __PMAX * sizeof (cygwin_buf_t)) < 0) + __PMAX * sizeof (wchar_t)) < 0) error (_("Error starting executable: %d"), errno); toexec = real_path; #ifdef __USEWIDE @@ -2442,13 +2441,13 @@ windows_nat_target::create_inferior (const char *exec_file, error (_("Error converting inferior cwd: %d"), errno); #ifdef __USEWIDE - args = (cygwin_buf_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2) + args = (wchar_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2) * sizeof (wchar_t)); wcscpy (args, toexec); wcscat (args, L" "); wcscat (args, cygallargs); #else /* !__USEWIDE */ - args = (cygwin_buf_t *) alloca (strlen (toexec) + strlen (cygallargs) + 2); + args = (char *) alloca (strlen (toexec) + strlen (cygallargs) + 2); strcpy (args, toexec); strcat (args, " "); strcat (args, cygallargs); -- 2.36.1