ports/devel/electron26/files/patch-third__party_libxml_src_dict.c
Hiroki Tagato 9ad5184453 devel/electron26: add port: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Build cross platform desktop apps with JavaScript, HTML, and CSS.

It's easier than you think.

If you can build a website, you can build a desktop app. Electron is a
framework for creating native applications with web technologies like
JavaScript, HTML, and CSS. It takes care of the hard parts so you can
focus on the core of your application.

WWW: https://electronjs.org/
2023-10-06 18:26:35 +09:00

41 lines
1,012 B
C

--- third_party/libxml/src/dict.c.orig 2023-03-30 00:34:13 UTC
+++ third_party/libxml/src/dict.c
@@ -133,7 +133,7 @@ struct _xmlDict {
static xmlMutex xmlDictMutex;
#ifdef DICT_RANDOMIZATION
-#ifdef HAVE_RAND_R
+#if defined(HAVE_RAND_R) && !defined(HAVE_ARC4RANDOM)
/*
* Internal data for random function, protected by xmlDictMutex
*/
@@ -160,7 +160,7 @@ int xmlInitializeDict(void) {
int __xmlInitializeDict(void) {
xmlInitMutex(&xmlDictMutex);
-#ifdef DICT_RANDOMIZATION
+#if defined(DICT_RANDOMIZATION) && !defined(HAVE_ARC4RANDOM)
#ifdef HAVE_RAND_R
rand_seed = time(NULL);
rand_r(& rand_seed);
@@ -175,13 +175,17 @@ int __xmlInitializeDict(void) {
int __xmlRandom(void) {
int ret;
+#ifdef HAVE_ARC4RANDOM
+ ret = arc4random();
+#else
xmlMutexLock(&xmlDictMutex);
-#ifdef HAVE_RAND_R
+# ifdef HAVE_RAND_R
ret = rand_r(& rand_seed);
-#else
+# else
ret = rand();
-#endif
+# endif
xmlMutexUnlock(&xmlDictMutex);
+#endif
return(ret);
}
#endif