emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android 5a58a6bc477 2/2: Port Android port to older Android syst


From: Po Lu
Subject: feature/android 5a58a6bc477 2/2: Port Android port to older Android systems
Date: Mon, 1 May 2023 20:16:59 -0400 (EDT)

branch: feature/android
commit 5a58a6bc477f290ee0b8a6111e92df56ff538719
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Port Android port to older Android systems
    
    * exec/config.h.in: Autoheader.
    * exec/configure.ac: Check for declarations of stpcpy and
    stpncpy.
    * exec/exec.c (stpcpy, stpncpy): Use replacements if
    declarations are not present; this happens when a new Android
    NDK is building for an old version of Android.
---
 exec/config.h.in  |  8 ++++++++
 exec/configure.ac |  1 +
 exec/exec.c       | 10 +++++-----
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/exec/config.h.in b/exec/config.h.in
index c276ff3f1f7..d8c225b631d 100644
--- a/exec/config.h.in
+++ b/exec/config.h.in
@@ -38,6 +38,14 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>. */
 /* Define to number of the `exec' system call. */
 #undef EXEC_SYSCALL
 
+/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
+   */
+#undef HAVE_DECL_STPCPY
+
+/* Define to 1 if you have the declaration of `stpncpy', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STPNCPY
+
 /* Define to 1 if you have the `getpagesize' function. */
 #undef HAVE_GETPAGESIZE
 
diff --git a/exec/configure.ac b/exec/configure.ac
index 9b4bcebe34e..f3eef60173c 100644
--- a/exec/configure.ac
+++ b/exec/configure.ac
@@ -55,6 +55,7 @@ AC_TYPE_PID_T
 
 AC_HEADER_STDBOOL
 AC_CHECK_FUNCS([getpagesize stpcpy stpncpy])
+AC_CHECK_DECLS([stpcpy, stpncpy])
 
 AH_BOTTOM([
 #ifdef HAVE_STDBOOL_H
diff --git a/exec/exec.c b/exec/exec.c
index df8c9430236..7f2cc75338b 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -50,7 +50,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 /* Define replacements for required string functions.  */
 
-#ifndef HAVE_STPCPY
+#if !defined HAVE_STPCPY || !defined HAVE_DECL_STPCPY
 
 /* Copy SRC to DEST, returning the address of the terminating '\0' in
    DEST.  */
@@ -72,14 +72,14 @@ rpl_stpcpy (char *dest, const char *src)
 }
 
 #define stpcpy rpl_stpcpy
-#endif /* !HAVE_STPCPY */
+#endif /* !defined HAVE_STPCPY || !defined HAVE_DECL_STPCPY */
 
-#ifndef HAVE_STPNCPY
+#if !defined HAVE_STPNCPY || !defined HAVE_DECL_STPNCPY
 
 /* Copy no more than N bytes of SRC to DST, returning a pointer past
    the last non-NUL byte written into DST.  */
 
-char *
+static char *
 rpl_stpncpy (char *dest, const char *src, size_t n)
 {
   char c, *s;
@@ -140,7 +140,7 @@ rpl_stpncpy (char *dest, const char *src, size_t n)
 }
 
 #define stpncpy rpl_stpncpy
-#endif /* !HAVE_STPNCPY */
+#endif /* !defined HAVE_STPNCPY || !defined HAVE_DECL_STPNCPY */
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]