Commit b74fdd23 authored by aleksana's avatar aleksana
Browse files

treewide: remove redundant patches and locks

These files are no longer referenced.
parent 9f737b7f
Loading
Loading
Loading
Loading
+0 −49
Original line number Diff line number Diff line
diff --git a/src/MACLib/APELink.cpp b/src/MACLib/APELink.cpp
index d349f4b..b00ec83 100644
--- a/src/MACLib/APELink.cpp
+++ b/src/MACLib/APELink.cpp
@@ -63,10 +63,10 @@ void CAPELink::ParseData(const char * pData, const str_utf16 * pFilename)
     if (pData != NULL)
     {
         // parse out the information
-        char * pHeader = strstr(pData, APE_LINK_HEADER);
-        char * pImageFile = strstr(pData, APE_LINK_IMAGE_FILE_TAG);
-        char * pStartBlock = strstr(pData, APE_LINK_START_BLOCK_TAG);
-        char * pFinishBlock = strstr(pData, APE_LINK_FINISH_BLOCK_TAG);
+        const char * pHeader = strstr(pData, APE_LINK_HEADER);
+        const char * pImageFile = strstr(pData, APE_LINK_IMAGE_FILE_TAG);
+        const char * pStartBlock = strstr(pData, APE_LINK_START_BLOCK_TAG);
+        const char * pFinishBlock = strstr(pData, APE_LINK_FINISH_BLOCK_TAG);
 
         if (pHeader && pImageFile && pStartBlock && pFinishBlock)
         {
@@ -81,7 +81,7 @@ void CAPELink::ParseData(const char * pData, const str_utf16 * pFilename)
                 
                 // get the path
                 char cImageFile[MAX_PATH + 1]; int nIndex = 0;
-                char * pImageCharacter = &pImageFile[strlen(APE_LINK_IMAGE_FILE_TAG)];
+                const char * pImageCharacter = &pImageFile[strlen(APE_LINK_IMAGE_FILE_TAG)];
                 while ((*pImageCharacter != 0) && (*pImageCharacter != '\r') && (*pImageCharacter != '\n'))
                     cImageFile[nIndex++] = *pImageCharacter++;
                 cImageFile[nIndex] = 0;
diff --git a/src/Shared/All.h b/src/Shared/All.h
index 328addc..7730e89 100644
--- a/src/Shared/All.h
+++ b/src/Shared/All.h
@@ -21,6 +21,8 @@ Global includes
     #include <windows.h>
 #endif
 
+#include <stdlib.h>
+
 #ifdef _WIN32
     #include <mmsystem.h>
     #include <tchar.h>
@@ -34,7 +36,6 @@ Global includes
     #include "NoWindows.h"
 #endif
 
-#include <stdlib.h>
 #include <memory.h>
 #include <stdio.h>
 #include <math.h>
+0 −12
Original line number Diff line number Diff line
diff --git a/intern/smoke/intern/WAVELET_NOISE.h b/intern/smoke/intern/WAVELET_NOISE.h
index fce901b..1f73c5e 100644
--- a/intern/smoke/intern/WAVELET_NOISE.h
+++ b/intern/smoke/intern/WAVELET_NOISE.h
@@ -43,6 +43,7 @@
 #ifndef WAVELET_NOISE_H
 #define WAVELET_NOISE_H
 
+#include <string.h>
 #include <MERSENNETWISTER.h>
 
 #ifdef WIN32
+0 −100
Original line number Diff line number Diff line
diff --git a/back.c b/back.c
index c1810dc..75416fb 100644
--- a/back.c
+++ b/back.c
@@ -25,7 +25,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "cfgfile.h"
 #include "cmd.h"
 
-#define CFGFILE		"/etc/spnavrc"
 
 int get_daemon_pid(void);
 static int update_cfg(void);
@@ -127,7 +126,7 @@ int get_daemon_pid(void)
 
 static int update_cfg(void)
 {
-	if(write_cfg(CFGFILE, &cfg) == -1) {
+	if(write_cfg(cfg_path(), &cfg) == -1) {
 		fprintf(stderr, "failed to update config file\n");
 		return -1;
 	}
diff --git a/cfgfile.c b/cfgfile.c
index 5a9c502..2ea323d 100644
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -22,12 +22,40 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <pwd.h>
 #include "cfgfile.h"
 
 enum {TX, TY, TZ, RX, RY, RZ};
 
 static const int def_axmap[] = {0, 2, 1, 3, 5, 4};
 static const int def_axinv[] = {0, 1, 1, 0, 1, 1};
+static char* config_path;
+
+char* cfg_path()
+{
+	char* buf;
+	if((buf = getenv("XDG_CONFIG_HOME"))) {
+		if(config_path == NULL) {
+			config_path = malloc(strlen(buf) + strlen("/spnavrc") + 1);
+			if ( config_path != NULL) {
+				sprintf(config_path, "%s/spnavrc", buf);
+			}
+		};
+		return config_path;
+	} else {
+		if (!(buf = getenv("HOME"))) {
+			struct passwd *pw = getpwuid(getuid());
+			buf = pw->pw_dir;
+		}
+		config_path = malloc(strlen(buf) + strlen("/.config/spnavrc") + 1);
+		if ( config_path != NULL) {
+			sprintf(config_path, "%s/.config/spnavrc", buf);
+		}
+		return config_path;
+	}
+}
 
 void default_cfg(struct cfg *cfg)
 {
diff --git a/cfgfile.h b/cfgfile.h
index dfed8c9..5bb1b2c 100644
--- a/cfgfile.h
+++ b/cfgfile.h
@@ -47,6 +47,7 @@ struct cfg {
 	int devid[MAX_CUSTOM][2];	/* custom USB vendor/product id list */
 };
 
+char* cfg_path(void);
 void default_cfg(struct cfg *cfg);
 int read_cfg(const char *fname, struct cfg *cfg);
 int write_cfg(const char *fname, struct cfg *cfg);
diff --git a/front_gtk.c b/front_gtk.c
index e4c2cd7..6a800a0 100644
--- a/front_gtk.c
+++ b/front_gtk.c
@@ -28,8 +28,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "cmd.h"
 #include "ui.h"
 
-#define CFGFILE		"/etc/spnavrc"
-
 #define CHK_AXINV_TRANS_X			"axinv_trans_x"
 #define CHK_AXINV_TRANS_Y			"axinv_trans_y"
 #define CHK_AXINV_TRANS_Z			"axinv_trans_z"
@@ -121,7 +119,7 @@ void frontend(int pfd)
 
 	gtk_init(&argc, 0);
 
-	read_cfg(CFGFILE, &cfg);
+	read_cfg(cfg_path(), &cfg);
 
 	create_ui();
 
+0 −40
Original line number Diff line number Diff line
diff --git a/back.c b/back.c
index f364e31..c1810dc 100644
--- a/back.c
+++ b/back.c
@@ -26,7 +26,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "cmd.h"
 
 #define CFGFILE		"/etc/spnavrc"
-#define PIDFILE		"/var/run/spnavd.pid"
 
 int get_daemon_pid(void);
 static int update_cfg(void);
@@ -97,11 +96,26 @@ int get_daemon_pid(void)
 {
 	FILE *fp;
 	char buf[64];
+	char* xdg_runtime_dir;
+	char* pidfile;
 
-	if(!(fp = fopen(PIDFILE, "r"))) {
+	if(!(xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"))){
+		fprintf(stderr, "XDG_RUNTIME_DIR not set, can't find spacenav pid file\n");
+		return -1;
+	}
+	pidfile = malloc(strlen(xdg_runtime_dir) + strlen("/spnavd.pid") + 1);
+	if (pidfile == NULL) {
+		fprintf(stderr, "failed to allocate memory\n");
+		return -1;
+	}
+	sprintf(pidfile, "%s/spnavd.pid", xdg_runtime_dir);
+
+	if(!(fp = fopen(pidfile, "r"))) {
 		fprintf(stderr, "no spacenav pid file, can't find daemon\n");
+		free(pidfile);
 		return -1;
 	}
+	free(pidfile);
 	if(!fgets(buf, sizeof buf, fp) || !isdigit(buf[0])) {
 		fprintf(stderr, "corrupted pidfile, can't find the daemon\n");
 		fclose(fp);
+0 −77
Original line number Diff line number Diff line
From 9dd8048e28b65da0b904dfbace482f70ae768fd8 Mon Sep 17 00:00:00 2001
From: Jeff Muizelaar <jmuizelaar@mozilla.com>
Date: Tue, 5 Mar 2024 04:12:28 +0100
Subject: [PATCH] Bug 1882291. Switch to stdarch_arm_neon_intrinsics feature on
 rust >=1.78. r=glandium

We only need this on ARM32 because the ARM64 intrinsics are stable.

stdarch_arm_neon_intrinsics was split out from stdsimd here:
https://github.com/rust-lang/stdarch/pull/1486

Differential Revision: https://phabricator.services.mozilla.com/D203039
---
 Cargo.lock          | 1 +
 gfx/qcms/Cargo.toml | 3 +++
 gfx/qcms/build.rs   | 7 +++++++
 gfx/qcms/src/lib.rs | 6 ++++--
 4 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 gfx/qcms/build.rs

diff --git a/Cargo.lock b/Cargo.lock
index aba397832e..8f0a879a87 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4276,6 +4276,7 @@ name = "qcms"
 version = "0.2.0"
 dependencies = [
  "libc",
+ "version_check",
 ]
 
 [[package]]
diff --git a/gfx/qcms/Cargo.toml b/gfx/qcms/Cargo.toml
index e976054a7b..f50d6623a1 100644
--- a/gfx/qcms/Cargo.toml
+++ b/gfx/qcms/Cargo.toml
@@ -20,3 +20,6 @@ cmyk = []
 
 [dependencies]
 libc = {version = "0.2", optional = true }
+
+[build-dependencies]
+version_check = "0.9"
diff --git a/gfx/qcms/build.rs b/gfx/qcms/build.rs
new file mode 100644
index 0000000000..6810a8828e
--- /dev/null
+++ b/gfx/qcms/build.rs
@@ -0,0 +1,7 @@
+extern crate version_check as rustc;
+
+fn main() {
+    if rustc::is_min_version("1.78.0").unwrap_or(false) {
+        println!("cargo:rustc-cfg=stdsimd_split");
+    }
+}
diff --git a/gfx/qcms/src/lib.rs b/gfx/qcms/src/lib.rs
index c311964ee3..fc496816a8 100644
--- a/gfx/qcms/src/lib.rs
+++ b/gfx/qcms/src/lib.rs
@@ -7,9 +7,11 @@
 #![allow(non_upper_case_globals)]
 // These are needed for the neon SIMD code and can be removed once the MSRV supports the
 // instrinsics we use
-#![cfg_attr(feature = "neon", feature(stdsimd))]
+#![cfg_attr(all(stdsimd_split, target_arch = "arm", feature = "neon"), feature(stdarch_arm_neon_intrinsics))]
+#![cfg_attr(all(stdsimd_split, target_arch = "arm", feature = "neon"), feature(stdarch_arm_feature_detection))]
+#![cfg_attr(all(not(stdsimd_split), target_arch = "arm", feature = "neon"), feature(stdsimd))]
 #![cfg_attr(
-    feature = "neon",
+    all(target_arch = "arm", feature = "neon"),
     feature(arm_target_feature, raw_ref_op)
 
 )]
-- 
2.44.0
Loading