From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id 6D0F33858C2C; Sun, 12 Jun 2022 16:07:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D0F33858C2C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jon TURNEY To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Simplify cygwin_buf_t X-Act-Checkin: binutils-gdb X-Git-Author: Jon Turney X-Git-Refname: refs/heads/master X-Git-Oldrev: 18a7c0667f8dd951a0bf7e8686bdf07e1c5349ea X-Git-Newrev: 7d941aa3aafca1c01547f88dae83522c8b9fc97f Message-Id: <20220612160756.6D0F33858C2C@sourceware.org> Date: Sun, 12 Jun 2022 16:07:56 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jun 2022 16:07:56 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7d941aa3aafc= a1c01547f88dae83522c8b9fc97f commit 7d941aa3aafca1c01547f88dae83522c8b9fc97f Author: Jon Turney Date: Thu Jun 2 14:49:45 2022 +0100 Simplify cygwin_buf_t =20 Prior to c6ca3dab dropping support for Cygwin 1.5, cygwin_buf_t was defined as char for Cygwin 1.5. After that, it's always wchar_t, so just use that. Diff: --- gdb/nat/windows-nat.c | 3 +-- gdb/windows-nat.c | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c index e52da16d9ce..5bd561ae63f 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 =20 @@ -200,7 +199,7 @@ windows_process_info::get_exec_module_filename (char *e= xe_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 =3D (cygwin_buf_t *) alloca (exe_name_max_len * = sizeof (cygwin_buf_t)); + wchar_t *pathbuf =3D (wchar_t *) alloca (exe_name_max_len * sizeof (wc= har_t)); =20 len =3D GetModuleFileNameEx (handle, dh_buf, pathbuf, exe_name_max_len); diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 277507ddf09..611193cd94a 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -157,7 +157,6 @@ static windows_per_inferior windows_process; #else # define __PMAX PATH_MAX # define __USEWIDE - typedef wchar_t cygwin_buf_t; # define STARTUPINFO STARTUPINFOW #endif =20 @@ -689,7 +688,7 @@ windows_make_so (const char *name, LPVOID load_addr) strcat (buf, "\\ntdll.dll"); } #else - cygwin_buf_t buf[__PMAX]; + wchar_t buf[__PMAX]; =20 buf[0] =3D 0; if (access (name, F_OK) !=3D 0) @@ -2351,13 +2350,13 @@ windows_nat_target::create_inferior (const char *ex= ec_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 =3D NULL; PWCHAR w32_env; size_t len; @@ -2414,7 +2413,7 @@ windows_nat_target::create_inferior (const char *exec= _file, { flags |=3D 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 =3D real_path; #ifdef __USEWIDE @@ -2453,13 +2452,13 @@ windows_nat_target::create_inferior (const char *ex= ec_file, error (_("Error converting inferior cwd: %d"), errno); =20 #ifdef __USEWIDE - args =3D (cygwin_buf_t *) alloca ((wcslen (toexec) + wcslen (cygallargs)= + 2) - * sizeof (wchar_t)); + args =3D (wchar_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2) + * sizeof (wchar_t)); wcscpy (args, toexec); wcscat (args, L" "); wcscat (args, cygallargs); #else /* !__USEWIDE */ - args =3D (cygwin_buf_t *) alloca (strlen (toexec) + strlen (cygallargs) = + 2); + args =3D (char *) alloca (strlen (toexec) + strlen (cygallargs) + 2); strcpy (args, toexec); strcat (args, " "); strcat (args, cygallargs);