From 24d9bd18346a690e988529b5002ff88dcd04bb32 Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Sun, 23 Jun 2024 14:35:34 -0400 Subject: [PATCH] Correct formatting of C code (#843) Apply the coding standards to the C code from #840 --- .../os/linux/aarch64/libspawner.so | Bin 25360 -> 25360 bytes .../os/linux/ppc64le/libspawner.so | Bin 75920 -> 75920 bytes .../os/linux/x86_64/libspawner.so | Bin 28640 -> 28640 bytes .../os/macosx/aarch64/libspawner.jnilib | Bin 53934 -> 53934 bytes .../os/macosx/x86_64/libspawner.jnilib | Bin 20664 -> 20664 bytes .../native_src/unix/exec_pty.c | 18 +++++++++++------- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/org.eclipse.cdt.core.linux.aarch64/os/linux/aarch64/libspawner.so b/core/org.eclipse.cdt.core.linux.aarch64/os/linux/aarch64/libspawner.so index 8ba80e4cd2b6aa6217f097dbe5c804f4d6c61540..af56945007e6bd913064abc6a1c2e4f4c87ec2b8 100755 GIT binary patch delta 55 zcmV-70LcH4#sQGV0kEI}6huy3F7TT{-d#_q68rOSMJ1ligtN2(C@%rSlie_90ppWJ NF}nf-60-s_4l$=;7G(ec delta 55 zcmV-70LcH4#sQGV0kEI}6jY9`>8LMIEa;5nW+I(~>h(sKIJ2|?C@%p+lie_90b`Rz NF}nhT5wij^4l%$g7Qz4k diff --git a/core/org.eclipse.cdt.core.linux.ppc64le/os/linux/ppc64le/libspawner.so b/core/org.eclipse.cdt.core.linux.ppc64le/os/linux/ppc64le/libspawner.so index ccdfc2cff1c2343294491ecb0dad903e19d037d7..5ddb32a2cdb88ed197e0c37772f2768472cfad8d 100755 GIT binary patch delta 62 zcmbPmk!8X~mJJISMPAPHc5TaPo5NJbx1vq^^%m#l>t1Z$!q{TXST=c~o%rMc+YH8f RFzbTt1;z=R7uvml2>@|u9DD!( delta 62 zcmbPmk!8X~mJJISMNWB4zgXn?@u%E+i@hS!ud<_U5`Jyo!q{TXSTuQ|o%rMc+YH8P RFzbTt1;(Du3+>*&1OS4n9Gw6F diff --git a/core/org.eclipse.cdt.core.linux.x86_64/os/linux/x86_64/libspawner.so b/core/org.eclipse.cdt.core.linux.x86_64/os/linux/x86_64/libspawner.so index 67882db51ad4de4c3af5c80b8d56fdf8b2b068e9..0e0ad421cdba026d7d55a6ab67ad2c2a5d435c32 100755 GIT binary patch delta 54 zcmV-60LlO0-vQv?0kGHs6scB?={Q9;Sl*U=LVy#&3>a6ugtP1c=PLnrlhiF?0e_P= MF0lcSv*<4PK)dJ|w*UYD delta 54 zcmV-60LlO0-vQv?0kGHs6mx!Tba_5z?RQ^%XbR@@?Aq1i%CqbN=PLnnlhiF?0eh1+ MF0lcOv*<4PKn$!KssI20 diff --git a/core/org.eclipse.cdt.core.macosx/os/macosx/aarch64/libspawner.jnilib b/core/org.eclipse.cdt.core.macosx/os/macosx/aarch64/libspawner.jnilib index b9886e7859de622f2ed27fd48d8b65edba1ff1a2..f983fc2f87f42aea0ee3d6b1954e4d7643545b6d 100755 GIT binary patch delta 130 zcmV-|0Db?ir30>|1F&EP5aW?^Cd{}tl8Z951y7hUcC&B=v?T$^lO-#k1n3(8GPB4l z2mt~J60_1Q9Hb!E6A_o|UMG7|1F&EP5YyJ*7Xytni_@% diff --git a/core/org.eclipse.cdt.core.macosx/os/macosx/x86_64/libspawner.jnilib b/core/org.eclipse.cdt.core.macosx/os/macosx/x86_64/libspawner.jnilib index 1e2990419af2a6c86fac03b9e4154a1fc05d51ca..f3bc76b697798969cff9e5ba5080c08e1397ce59 100755 GIT binary patch delta 50 zcmV-20L}lnp#iv|0k9Ya5K@WZ Ivxy%sG3Y81$p8QV delta 50 zcmV-20L}lnp#iv|0k9Ya5K2ffsr@WV Ivxy%sG3=ods{jB1 diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/exec_pty.c b/core/org.eclipse.cdt.core.native/native_src/unix/exec_pty.c index 7a3a9303910..db7c829ff57 100644 --- a/core/org.eclipse.cdt.core.native/native_src/unix/exec_pty.c +++ b/core/org.eclipse.cdt.core.native/native_src/unix/exec_pty.c @@ -34,12 +34,12 @@ extern char *pfind(const char *name, char *const envp[]); static int sys_close_range_wrapper(unsigned int from_fd_inclusive) { // Use fast `close_range` (https://man7.org/linux/man-pages/man2/close_range.2.html) if available. // Cannot call `close_range` from libc, as it may be unavailable in older libc. -# if defined(__linux__) && defined(SYS_close_range) && defined(CLOSE_RANGE_UNSHARE) +#if defined(__linux__) && defined(SYS_close_range) && defined(CLOSE_RANGE_UNSHARE) return syscall(SYS_close_range, from_fd_inclusive, ~0U, CLOSE_RANGE_UNSHARE); -# else +#else errno = ENOSYS; return -1; -# endif +#endif } static int close_all_fds_using_parsing(unsigned int from_fd_inclusive) { @@ -57,7 +57,8 @@ static int close_all_fds_using_parsing(unsigned int from_fd_inclusive) { #endif DIR *dirp = opendir(FD_DIR); - if (dirp == NULL) return -1; + if (dirp == NULL) + return -1; struct dirent *direntp; @@ -77,7 +78,8 @@ static int close_all_fds_using_parsing(unsigned int from_fd_inclusive) { static void close_all_fds_fallback(unsigned int from_fd_inclusive) { int fdlimit = sysconf(_SC_OPEN_MAX); - if (fdlimit == -1) fdlimit = 65535; // arbitrary default, just in case + if (fdlimit == -1) + fdlimit = 65535; // arbitrary default, just in case for (int fd = from_fd_inclusive; fd < fdlimit; fd++) { close(fd); } @@ -85,8 +87,10 @@ static void close_all_fds_fallback(unsigned int from_fd_inclusive) { static void close_all_fds() { unsigned int from_fd = STDERR_FILENO + 1; - if (sys_close_range_wrapper(from_fd) == 0) return; - if (close_all_fds_using_parsing(from_fd) == 0) return; + if (sys_close_range_wrapper(from_fd) == 0) + return; + if (close_all_fds_using_parsing(from_fd) == 0) + return; close_all_fds_fallback(from_fd); }