From f47c5e15f99da3aa09d2d1e0b31135d5d5f049b8 Mon Sep 17 00:00:00 2001 From: sjpark Date: Thu, 8 Sep 2022 16:34:14 +0900 Subject: [PATCH] strdup --- src/blackwhitelist.c | 2 +- src/goodbyedpi.c | 6 +++--- src/goodbyedpi.h | 2 ++ src/service.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/blackwhitelist.c b/src/blackwhitelist.c index f5fa4282..e59b59d9 100644 --- a/src/blackwhitelist.c +++ b/src/blackwhitelist.c @@ -39,7 +39,7 @@ static int add_hostname(const char *host) { char *host_c = NULL; if (!check_get_hostname(host)) { - host_c = _strdup(host); + host_c = strdup(host); tmp_record->host = host_c; HASH_ADD_KEYPTR(hh, blackwhitelist, tmp_record->host, strlen(tmp_record->host), tmp_record); diff --git a/src/goodbyedpi.c b/src/goodbyedpi.c index b68e198c..1dede352 100644 --- a/src/goodbyedpi.c +++ b/src/goodbyedpi.c @@ -622,9 +622,9 @@ int main(int argc, char *argv[]) { } if (filter_string == NULL) - filter_string = _strdup(FILTER_STRING_TEMPLATE); + filter_string = strdup(FILTER_STRING_TEMPLATE); if (filter_passive_string == NULL) - filter_passive_string = _strdup(FILTER_PASSIVE_STRING_TEMPLATE); + filter_passive_string = strdup(FILTER_PASSIVE_STRING_TEMPLATE); printf( "GoodbyeDPI " GOODBYEDPI_VERSION @@ -827,7 +827,7 @@ int main(int argc, char *argv[]) { optarg = argv[optind]; if (optarg) { - char *autottl_copy = _strdup(optarg); + char *autottl_copy = strdup(optarg); if (strchr(autottl_copy, '-')) { // token "-" found, start X-Y parser char *autottl_current = strtok(autottl_copy, "-"); diff --git a/src/goodbyedpi.h b/src/goodbyedpi.h index 5dd3d47c..a54cd9a3 100644 --- a/src/goodbyedpi.h +++ b/src/goodbyedpi.h @@ -9,3 +9,5 @@ int main(int argc, char *argv[]); void deinit_all(); + +#define strdup _strdup diff --git a/src/service.c b/src/service.c index 91fa767c..90425f8a 100644 --- a/src/service.c +++ b/src/service.c @@ -32,7 +32,7 @@ int service_register(int argc, char *argv[]) service_argc = argc; service_argv = calloc((size_t)(argc + 1), sizeof(void*)); for (i = 0; i < argc; i++) { - service_argv[i] = _strdup(argv[i]); + service_argv[i] = strdup(argv[i]); } }