diff options
| author | Po Lu | 2023-03-15 15:38:19 +0800 |
|---|---|---|
| committer | Po Lu | 2023-03-15 15:38:19 +0800 |
| commit | 8fbac937fbaf0d74ded6eebdf6acd4636d7b00ea (patch) | |
| tree | 3cd6e131b0b90db530117c83681e7d537612a18e /lib-src | |
| parent | 5b9d6738d119d2c450dd8f060793aebe3f64fc72 (diff) | |
| download | emacs-8fbac937fbaf0d74ded6eebdf6acd4636d7b00ea.tar.gz emacs-8fbac937fbaf0d74ded6eebdf6acd4636d7b00ea.zip | |
Port to systems without endian.h
* lib-src/asset-directory-tool.c (main_2): Port to systems
without htole32.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/asset-directory-tool.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib-src/asset-directory-tool.c b/lib-src/asset-directory-tool.c index e53398eceb0..239ab083b66 100644 --- a/lib-src/asset-directory-tool.c +++ b/lib-src/asset-directory-tool.c | |||
| @@ -22,7 +22,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 22 | #include <stdio.h> | 22 | #include <stdio.h> |
| 23 | #include <fcntl.h> | 23 | #include <fcntl.h> |
| 24 | #include <errno.h> | 24 | #include <errno.h> |
| 25 | #include <endian.h> | 25 | #include <byteswap.h> |
| 26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
| 27 | #include <dirent.h> | 27 | #include <dirent.h> |
| 28 | #include <string.h> | 28 | #include <string.h> |
| @@ -197,7 +197,11 @@ main_2 (int fd, struct directory_tree *tree, size_t *offset) | |||
| 197 | croak ("write"); | 197 | croak ("write"); |
| 198 | 198 | ||
| 199 | /* Write the offset. */ | 199 | /* Write the offset. */ |
| 200 | output = htole32 (tree->offset); | 200 | #ifdef WORDS_BIGENDIAN |
| 201 | output = bswap_32 (tree->offset); | ||
| 202 | #else | ||
| 203 | output = tree->offset; | ||
| 204 | #endif | ||
| 201 | if (write (fd, &output, 4) < 1) | 205 | if (write (fd, &output, 4) < 1) |
| 202 | croak ("write"); | 206 | croak ("write"); |
| 203 | size += 4; | 207 | size += 4; |