1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
From: Gwen Weinholt <git@weinholt.se>
Date: Sat, 11 Jan 2025 21:38:21 +0100
Subject: Fix builds on 32-bit arm
Fixes an assumption of signed chars and defines SCM_LLONG as long
long.
---
scmfig.h | 5 +++++
script.c | 25 +++++++++++++++----------
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/scmfig.h b/scmfig.h
index ff2f6b0..ed5f732 100644
--- a/scmfig.h
+++ b/scmfig.h
@@ -304,6 +304,11 @@ rgx.c init_rgx(); regcomp and regexec. */
# define SCM_LLONG __int128
# endif
#endif
+#if defined(__ARMEL__)
+# ifdef __GNUC__ /* Includes gcc, clang, and llvm-gcc */
+# define SCM_LLONG long long
+# endif
+#endif
#ifdef MSDOS /* Microsoft C 5.10 and 6.00A */
# ifndef GO32
# define SHORT_INT
diff --git a/script.c b/script.c
index 910d213..2a33fc5 100755
--- a/script.c
+++ b/script.c
@@ -120,15 +120,19 @@ char *script_find_executable(name)
f = fopen(name, "r");
if (!f) return 0L;
if ((fgetc(f)=='#') && (fgetc(f)=='!')) {
- while (1) switch (tbuf[i++] = fgetc(f)) {
- case ' ':
- if (1==i) {i--; break;}
- case '\t':case '\r':case '\f':
- case EOF:
- tbuf[--i] = 0;
- fclose(f);
- if (0==i) return 0L;
- return scm_cat_path(0L, tbuf, 0L);
+ while (1) {
+ int chr = fgetc(f);
+ tbuf[i++] = chr;
+ switch (chr) {
+ case ' ':
+ if (1==i) {i--; break;}
+ case '\t':case '\r':case '\f':
+ case EOF:
+ tbuf[--i] = 0;
+ fclose(f);
+ if (0==i) return 0L;
+ return scm_cat_path(0L, tbuf, 0L);
+ }
}
}
fclose(f);
@@ -297,7 +301,8 @@ char *script_read_arg(f)
}
morearg:
while (1) {
- switch (tbuf[tind++] = chr) {
+ tbuf[tind++] = chr;
+ switch (chr) {
case WHITE_SPACES:
case LINE_INCREMENTORS:
if (qted) break;
|