You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.3 KiB
39 lines
1.3 KiB
From be60850c79dcb62cf682ea496ec22d8ea45f9da2 Mon Sep 17 00:00:00 2001
|
|
From: Chih-Wei Huang <cwhuang@linux.org.tw>
|
|
Date: Thu, 10 Jan 2019 16:44:38 +0800
|
|
Subject: [PATCH 06/63] Define strdupa if it is not defined
|
|
|
|
Android does not include strdupa in <string.h>. Define strdupa if it has
|
|
not already been defined.
|
|
|
|
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
|
|
---
|
|
src/util.h | 11 +++++++++++
|
|
1 file changed, 11 insertions(+)
|
|
|
|
diff --git a/src/util.h b/src/util.h
|
|
index 6d3c10e946e..d98bfa1beed 100644
|
|
--- a/src/util.h
|
|
+++ b/src/util.h
|
|
@@ -252,6 +252,17 @@ lcm(uint64_t x, uint64_t y)
|
|
return (x / n) * y;
|
|
}
|
|
|
|
+#ifndef strdupa
|
|
+#define strdupa(s) \
|
|
+ (__extension__ ({ \
|
|
+ const char *__in = (s); \
|
|
+ size_t __len = strlen (__in); \
|
|
+ char *__out = (char *) alloca (__len + 1); \
|
|
+ strcpy(__out, __in); \
|
|
+ __out; \
|
|
+ }))
|
|
+#endif
|
|
+
|
|
#ifndef strndupa
|
|
#define strndupa(s, l) \
|
|
(__extension__ ({ \
|
|
--
|
|
2.26.2
|
|
|