-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4664e35
commit 38f3843
Showing
3 changed files
with
219 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
From 5467e83e71420fea4c028ea5f461aad9fed1bb21 Mon Sep 17 00:00:00 2001 | ||
From: Eli Schwartz <[email protected]> | ||
Date: Sun, 11 Feb 2024 12:42:09 -0500 | ||
Subject: [PATCH] Adapt meson.build to removal of winsock | ||
|
||
Signed-off-by: Eli Schwartz <[email protected]> | ||
--- | ||
meson.build | 5 ----- | ||
src/meson.build | 2 +- | ||
tests/meson.build | 2 +- | ||
tools/meson.build | 2 +- | ||
4 files changed, 3 insertions(+), 8 deletions(-) | ||
|
||
diff --git a/meson.build b/meson.build | ||
index 27808d3..cb4a729 100644 | ||
--- a/meson.build | ||
+++ b/meson.build | ||
@@ -16,7 +16,6 @@ libidn2_dep = notfound | ||
libicu_dep = notfound | ||
libidn_dep = notfound | ||
libunistring = notfound | ||
-networking_deps = notfound | ||
libiconv_dep = notfound | ||
|
||
link_language = 'c' | ||
@@ -77,10 +76,6 @@ if libidn2_dep.found() or libidn_dep.found() | ||
libiconv_dep = dependency('iconv') | ||
endif | ||
|
||
-if host_machine.system() == 'windows' | ||
- networking_deps = cc.find_library('ws2_32') | ||
-endif | ||
- | ||
if enable_runtime == 'auto' | ||
enable_runtime = 'no' | ||
endif | ||
diff --git a/src/meson.build b/src/meson.build | ||
index 92366f2..180641d 100644 | ||
--- a/src/meson.build | ||
+++ b/src/meson.build | ||
@@ -37,7 +37,7 @@ endif | ||
libpsl = library('psl', sources, suffixes_dafsa_h, | ||
include_directories : [configinc, includedir], | ||
c_args : cargs, | ||
- dependencies : [libidn2_dep, libidn_dep, libicu_dep, libunistring, networking_deps, libiconv_dep], | ||
+ dependencies : [libidn2_dep, libidn_dep, libicu_dep, libunistring, libiconv_dep], | ||
gnu_symbol_visibility: 'hidden', | ||
version: library_version, | ||
install: true, | ||
diff --git a/tests/meson.build b/tests/meson.build | ||
index d8c266d..3531aa3 100644 | ||
--- a/tests/meson.build | ||
+++ b/tests/meson.build | ||
@@ -38,6 +38,6 @@ foreach test_name : tests | ||
link_with : libpsl, | ||
include_directories : configinc, | ||
link_language : link_language, | ||
- dependencies : [libpsl_dep, networking_deps]) | ||
+ dependencies : [libpsl_dep]) | ||
test(test_name, exe, depends : [psl_dafsa, psl_ascii_dafsa]) | ||
endforeach | ||
diff --git a/tools/meson.build b/tools/meson.build | ||
index e2ea10a..6bdce2e 100644 | ||
--- a/tools/meson.build | ||
+++ b/tools/meson.build | ||
@@ -2,7 +2,7 @@ psl = executable('psl', 'psl.c', | ||
include_directories : configinc, | ||
c_args : ['-DHAVE_CONFIG_H'], | ||
link_language : link_language, | ||
- dependencies : [libpsl_dep, networking_deps], | ||
+ dependencies : [libpsl_dep], | ||
install : true, | ||
) | ||
|
||
-- | ||
2.43.0 | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
From 5046a82634b2855fcad594c748496562aaf83e57 Mon Sep 17 00:00:00 2001 | ||
From ce6a2985b3211a7b04077a7caefaf36814f9c02e Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <[email protected]> | ||
Date: Sat, 20 Jan 2024 18:36:26 +0100 | ||
Subject: [PATCH] Implement is_ip4() and is_ip6() to avoid network | ||
Subject: [PATCH 1/2] Implement is_ip4() and is_ip6() to avoid network | ||
dependencies. | ||
|
||
Signed-off-by: Eli Schwartz <[email protected]> | ||
[added meson.build changes as well] | ||
--- | ||
configure.ac | 13 ------- | ||
meson.build | 4 -- | ||
src/psl.c | 107 ++++++++++++++++++++++++++++++++++++--------------- | ||
3 files changed, 77 insertions(+), 47 deletions(-) | ||
configure.ac | 13 ------ | ||
src/psl.c | 109 +++++++++++++++++++++++++++++++++++++-------------- | ||
2 files changed, 79 insertions(+), 43 deletions(-) | ||
|
||
diff --git a/configure.ac b/configure.ac | ||
index bb8b345..0e0d8ea 100644 | ||
index 330acc8..d854988 100644 | ||
--- a/configure.ac | ||
+++ b/configure.ac | ||
@@ -299,19 +299,6 @@ elif test -n "$NEEDS_SOCKET" ; then | ||
|
@@ -36,26 +33,11 @@ index bb8b345..0e0d8ea 100644 | |
fi | ||
|
||
# Check for clock_gettime() used for performance measurement | ||
diff --git a/meson.build b/meson.build | ||
index 27808d3..574c772 100644 | ||
--- a/meson.build | ||
+++ b/meson.build | ||
@@ -77,10 +77,6 @@ if libidn2_dep.found() or libidn_dep.found() | ||
libiconv_dep = dependency('iconv') | ||
endif | ||
|
||
-if host_machine.system() == 'windows' | ||
- networking_deps = cc.find_library('ws2_32') | ||
-endif | ||
- | ||
if enable_runtime == 'auto' | ||
enable_runtime = 'no' | ||
endif | ||
diff --git a/src/psl.c b/src/psl.c | ||
index 4c5c95e..0168a68 100644 | ||
index fa6bfd4..b3d7225 100644 | ||
--- a/src/psl.c | ||
+++ b/src/psl.c | ||
@@ -47,15 +47,6 @@ | ||
@@ -41,15 +41,6 @@ | ||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
|
||
|
@@ -71,18 +53,20 @@ index 4c5c95e..0168a68 100644 | |
#if defined(_MSC_VER) && ! defined(ssize_t) | ||
# include <basetsd.h> | ||
typedef SSIZE_T ssize_t; | ||
@@ -76,10 +67,6 @@ typedef SSIZE_T ssize_t; | ||
@@ -67,10 +58,8 @@ typedef SSIZE_T ssize_t; | ||
# include <langinfo.h> | ||
#endif | ||
|
||
-#ifndef _WIN32 | ||
-# include <arpa/inet.h> | ||
-#endif | ||
- | ||
#ifdef HAVE_ALLOCA_H | ||
# include <alloca.h> | ||
#elif defined _WIN32 | ||
@@ -1588,30 +1575,90 @@ int psl_check_version_number(int version) | ||
-#else | ||
-# include <malloc.h> | ||
+#ifdef _WIN32 | ||
+# include <malloc.h> | ||
#endif | ||
|
||
#ifdef WITH_LIBICU | ||
@@ -1579,30 +1568,90 @@ int psl_check_version_number(int version) | ||
|
||
return PSL_VERSION_NUMBER; | ||
} | ||
|
@@ -190,6 +174,128 @@ index 4c5c95e..0168a68 100644 | |
} | ||
|
||
/** | ||
-- | ||
2.43.0 | ||
|
||
From 7d770638d2a23487ac30c8e55d73a280027a3208 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <[email protected]> | ||
Date: Sun, 4 Feb 2024 18:38:34 +0100 | ||
Subject: [PATCH 2/2] Get rid of Windows WSA startup code | ||
|
||
Reported-by: @vszakats (github.com) | ||
--- | ||
src/psl.c | 7 +++++++ | ||
tests/test-is-cookie-domain-acceptable.c | 16 ---------------- | ||
tools/psl.c | 21 +-------------------- | ||
3 files changed, 8 insertions(+), 36 deletions(-) | ||
|
||
diff --git a/src/psl.c b/src/psl.c | ||
index b3d7225..3f254bc 100644 | ||
--- a/src/psl.c | ||
+++ b/src/psl.c | ||
@@ -41,6 +41,13 @@ | ||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
|
||
+#if defined(_WIN32) && (defined(WITH_LIBIDN2) || defined(WITH_LIBIDN)) | ||
+# ifndef WIN32_LEAN_AND_MEAN | ||
+# define WIN32_LEAN_AND_MEAN | ||
+# endif | ||
+# include <windows.h> /* for GetACP() */ | ||
+#endif | ||
+ | ||
#if defined(_MSC_VER) && ! defined(ssize_t) | ||
# include <basetsd.h> | ||
typedef SSIZE_T ssize_t; | ||
diff --git a/tests/test-is-cookie-domain-acceptable.c b/tests/test-is-cookie-domain-acceptable.c | ||
index f7f833d..7bf4f11 100644 | ||
--- a/tests/test-is-cookie-domain-acceptable.c | ||
+++ b/tests/test-is-cookie-domain-acceptable.c | ||
@@ -32,10 +32,6 @@ | ||
# include <config.h> | ||
#endif | ||
|
||
-#ifdef _WIN32 | ||
-# include <winsock2.h> // WSAStartup, WSACleanup | ||
-#endif | ||
- | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
@@ -111,18 +107,6 @@ static void test_psl(void) | ||
|
||
int main(int argc, const char * const *argv) | ||
{ | ||
-#ifdef _WIN32 | ||
- WSADATA wsa_data; | ||
- int err; | ||
- | ||
- if ((err = WSAStartup(MAKEWORD(2,2), &wsa_data))) { | ||
- printf("WSAStartup failed with error: %d\n", err); | ||
- return 1; | ||
- } | ||
- | ||
- atexit((void (__cdecl*)(void)) WSACleanup); | ||
-#endif | ||
- | ||
/* if VALGRIND testing is enabled, we have to call ourselves with valgrind checking */ | ||
if (argc == 1) { | ||
const char *valgrind = getenv("TESTS_VALGRIND"); | ||
diff --git a/tools/psl.c b/tools/psl.c | ||
index 527d780..5b34013 100644 | ||
--- a/tools/psl.c | ||
+++ b/tools/psl.c | ||
@@ -37,8 +37,6 @@ | ||
#endif | ||
|
||
#ifdef _WIN32 | ||
-# include <winsock2.h> // WSAStartup, WSACleanup | ||
- | ||
// Windows does not have localtime_r but has localtime_s, which is more or less | ||
// the same except that the arguments are reversed | ||
# define LOCALTIME_R_SUCCESSFUL(t_sec,t_now) \ | ||
@@ -52,6 +50,7 @@ | ||
#include <string.h> | ||
#include <ctype.h> | ||
#include <locale.h> | ||
+#include <time.h> | ||
|
||
#include <libpsl.h> | ||
|
||
@@ -78,20 +77,6 @@ static void usage(int err, FILE* f) | ||
exit(err); | ||
} | ||
|
||
-static void init_windows(void) { | ||
-#ifdef _WIN32 | ||
- WSADATA wsa_data; | ||
- int err; | ||
- | ||
- if ((err = WSAStartup(MAKEWORD(2,2), &wsa_data))) { | ||
- printf("WSAStartup failed with error: %d\n", err); | ||
- exit(EXIT_FAILURE); | ||
- } | ||
- | ||
- atexit((void (__cdecl*)(void)) WSACleanup); | ||
-#endif | ||
-} | ||
- | ||
/* RFC 2822-compliant date format */ | ||
static const char *time2str(time_t t) | ||
{ | ||
@@ -238,8 +223,6 @@ int main(int argc, const char *const *argv) | ||
else if (mode == 4) { | ||
char *cookie_domain_lower; | ||
|
||
- init_windows(); | ||
- | ||
if ((rc = psl_str_to_utf8lower(domain, NULL, NULL, &cookie_domain_lower)) == PSL_SUCCESS) { | ||
if (!batch_mode) | ||
printf("%s: ", domain); | ||
@@ -284,8 +267,6 @@ int main(int argc, const char *const *argv) | ||
} | ||
} | ||
else if (mode == 4) { | ||
- init_windows(); | ||
- | ||
for (; arg < argv + argc; arg++) { | ||
if (!batch_mode) | ||
printf("%s: ", *arg); |