Open
Conversation
Collaborator
|
Thank you for the PR.
Just for information, does this fix the issue: diff --git app/src/compat.h app/src/compat.h
index 296d1a9ff..59a2771a2 100644
--- app/src/compat.h
+++ app/src/compat.h
@@ -103,7 +103,7 @@ long nrand48(unsigned short xsubi[3]);
long jrand48(unsigned short xsubi[3]);
#endif
-#ifndef HAVE_REALLOCARRAY
+#if !defined(HAVE_REALLOCARRAY) || (defined(__ANDROID_API__) && __ANDROID_API__ < 29)
void *reallocarray(void *ptr, size_t nmemb, size_t size);
#endif
? EDIT: fixed the condition |
Author
This declares if you want to inline the condition, then: diff --git a/app/src/compat.c b/app/src/compat.c
index 785f843..289f54f 100644
--- a/app/src/compat.c
+++ b/app/src/compat.c
@@ -3,7 +3,7 @@
#include "config.h"
#include <assert.h>
-#ifndef HAVE_REALLOCARRAY
+#if !defined(HAVE_REALLOCARRAY) || (defined(__ANDROID_API__) && __ANDROID_API__ < 29)
# include <errno.h>
#endif
#include <stdlib.h>
@@ -98,7 +98,7 @@ long jrand48(unsigned short xsubi[3]) {
#endif
#endif
-#ifndef HAVE_REALLOCARRAY
+#if !defined(HAVE_REALLOCARRAY) || (defined(__ANDROID_API__) && __ANDROID_API__ < 29)
void *reallocarray(void *ptr, size_t nmemb, size_t size) {
size_t bytes;
if (__builtin_mul_overflow(nmemb, size, &bytes)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
meson's
cc.has_function(f)only does a link check (faster)on Android's bionic libc,
reallocarraylinks, but the headers don't definereallocarrayolder malloc.h (on termux):
if the header does not define it, (
__ANDROID_API__too low), then usecompat.cfallback ?symbol check is not a function check, but I don't know how to do a function check
-D_GNU_SOURCEis needed because this is the command used by meson:without
-std=c11, it'd work,somewhere above:
defines
_GNU_SOURCE, but I found no way of passingconftocc.has_header_symbolto not have to doextras:
cc.has_function()cc.has_header_symbol()