plugin_services: scope str_trim and the JSON readers to POSIX too
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-12 08:38:17
Commitc9a520eb
Parentsda52ce31
Changed files
src/plugin_services.c+3−1■■■■
1 file+3−1
Diff
src/plugin_services.c+3−1■■■■
index 6902b96..cd49e27 100644
--- a/src/plugin_services.c
+++ b/src/plugin_services.c
@@ -189,6 +189,7 @@ static void str_copy(char *dst, size_t sz, const char *src)
189189 dst[n] = '\0';
190190 }
191191
192+#if !defined(_WIN32)
192193 static void str_trim(char *s)
193194 {
194195 char *p;
@@ -200,6 +201,7 @@ static void str_trim(char *s)
200201 n = strlen(s);
201202 while (n > 0 && isspace((unsigned char)s[n - 1])) s[--n] = '\0';
202203 }
204+#endif
203205
204206 static void url_decode(char *s)
205207 {
@@ -359,6 +361,7 @@ static int run_argv(char *const argv[])
359361 /* ------------------------------------------------------------------ */
360362 /* The JSON readers and the systemd/launchd parsers are POSIX-only: the
361363 * Windows slice talks to the SCM directly and never parses text. */
364+#if !defined(_WIN32)
362365
363366 static int json_read_string_at(const char **pp, char *out, size_t outsz)
364367 {
@@ -478,7 +481,6 @@ static svc_t *svc_find(const char *name)
478481 return NULL;
479482 }
480483
481-#if !defined(_WIN32)
482484 static char *read_file_all(const char *path, size_t *len)
483485 {
484486 FILE *f;
485487
src/plugin_services.c+3−1■■■■
index 6902b96..cd49e27 100644index 6902b96..cd49e27 100644
--- a/src/plugin_services.c--- a/src/plugin_services.c
+++ b/src/plugin_services.c+++ b/src/plugin_services.c
@@ -189,6 +189,7 @@ static void str_copy(char *dst, size_t sz, const char *src)@@ -189,6 +189,7 @@ static void str_copy(char *dst, size_t sz, const char *src)
189 dst[n] = '\0';189 dst[n] = '\0';
190 }190 }
191 191
192+#if !defined(_WIN32)
192 static void str_trim(char *s)193 static void str_trim(char *s)
193 {194 {
194 char *p;195 char *p;
@@ -200,6 +201,7 @@ static void str_trim(char *s)@@ -200,6 +201,7 @@ static void str_trim(char *s)
200 n = strlen(s);201 n = strlen(s);
201 while (n > 0 && isspace((unsigned char)s[n - 1])) s[--n] = '\0';202 while (n > 0 && isspace((unsigned char)s[n - 1])) s[--n] = '\0';
202 }203 }
204+#endif
203 205
204 static void url_decode(char *s)206 static void url_decode(char *s)
205 {207 {
@@ -359,6 +361,7 @@ static int run_argv(char *const argv[])@@ -359,6 +361,7 @@ static int run_argv(char *const argv[])
359 /* ------------------------------------------------------------------ */361 /* ------------------------------------------------------------------ */
360 /* The JSON readers and the systemd/launchd parsers are POSIX-only: the362 /* The JSON readers and the systemd/launchd parsers are POSIX-only: the
361 * Windows slice talks to the SCM directly and never parses text. */363 * Windows slice talks to the SCM directly and never parses text. */
364+#if !defined(_WIN32)
362 365
363 static int json_read_string_at(const char **pp, char *out, size_t outsz)366 static int json_read_string_at(const char **pp, char *out, size_t outsz)
364 {367 {
@@ -478,7 +481,6 @@ static svc_t *svc_find(const char *name)@@ -478,7 +481,6 @@ static svc_t *svc_find(const char *name)
478 return NULL;481 return NULL;
479 }482 }
480 483
481-#if !defined(_WIN32)
482 static char *read_file_all(const char *path, size_t *len)484 static char *read_file_all(const char *path, size_t *len)
483 {485 {
484 FILE *f;486 FILE *f;
485487