From 8cd97d57f900ef42e85ece1660b47f392a5b527c Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Thu, 12 Dec 2024 01:54:45 -0500 Subject: [PATCH] cleanup: remove now-unused net_http_special (#17250) --- Makefile.common | 1 - cheevos/cheevos_client.c | 1 - griffin/griffin.c | 1 - network/net_http_special.c | 113 ------------------------------------- network/net_http_special.h | 33 ----------- 5 files changed, 149 deletions(-) delete mode 100644 network/net_http_special.c delete mode 100644 network/net_http_special.h diff --git a/Makefile.common b/Makefile.common index ee4c445017..155faf7938 100644 --- a/Makefile.common +++ b/Makefile.common @@ -2176,7 +2176,6 @@ ifeq ($(HAVE_NETWORKING), 1) $(LIBRETRO_COMM_DIR)/net/net_socket.o \ core_updater_list.o \ network/natt.o \ - network/net_http_special.o \ tasks/task_http.o \ tasks/task_netplay_lan_scan.o \ tasks/task_netplay_nat_traversal.o \ diff --git a/cheevos/cheevos_client.c b/cheevos/cheevos_client.c index 294baad319..10c0048098 100644 --- a/cheevos/cheevos_client.c +++ b/cheevos/cheevos_client.c @@ -29,7 +29,6 @@ #include #include "../frontend/frontend_driver.h" -#include "../network/net_http_special.h" #include "../tasks/tasks_internal.h" #ifdef HAVE_PRESENCE diff --git a/griffin/griffin.c b/griffin/griffin.c index 30d83c1893..2e83a696d8 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -197,7 +197,6 @@ ACHIEVEMENTS #define RC_CLIENT_SUPPORTS_HASH 1 #include "../libretro-common/formats/cdfs/cdfs.c" -#include "../network/net_http_special.c" #include "../cheevos/cheevos.c" #include "../cheevos/cheevos_client.c" diff --git a/network/net_http_special.c b/network/net_http_special.c deleted file mode 100644 index b695bdca8f..0000000000 --- a/network/net_http_special.c +++ /dev/null @@ -1,113 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2016 - Daniel De Matteis - * Copyright (C) 2015-2017 - Andre Leiradella - * Copyright (C) 2016-2019 - Brad Parker - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include - -#include -#include - -#include "net_http_special.h" - -int net_http_get(const char **result, size_t *size, - const char *url, retro_time_t *timeout) -{ - size_t length; - uint8_t* data = NULL; - char* res = NULL; - int ret = NET_HTTP_GET_OK; - struct http_t* http = NULL; - retro_time_t t0 = cpu_features_get_time_usec(); - struct http_connection_t *conn = net_http_connection_new(url, "GET", NULL); - - *result = NULL; - - /* Error creating the connection descriptor. */ - if (!conn) - goto error; - - /* Don't bother with timeouts here, it's just a string scan. */ - while (!net_http_connection_iterate(conn)) {} - - /* Error finishing the connection descriptor. */ - if (!net_http_connection_done(conn)) - { - ret = NET_HTTP_GET_MALFORMED_URL; - goto error; - } - - http = net_http_new(conn); - - /* Error connecting to the endpoint. */ - if (!http) - { - ret = NET_HTTP_GET_CONNECT_ERROR; - goto error; - } - - while (!net_http_update(http, NULL, NULL)) - { - /* Timeout error. */ - if (timeout && (cpu_features_get_time_usec() - t0) > *timeout) - { - ret = NET_HTTP_GET_TIMEOUT; - goto error; - } - } - - data = net_http_data(http, &length, false); - - if (data) - { - res = (char*)malloc(length + 1); - - /* Allocation error. */ - if (!res) - goto error; - - memcpy((void*)res, (void*)data, length); - free(data); - res[length] = 0; - *result = res; - } - else - { - length = 0; - *result = NULL; - } - - if (size) - *size = length; - -error: - if (http) - net_http_delete(http); - - if (conn) - net_http_connection_free(conn); - - if (timeout) - { - t0 = cpu_features_get_time_usec() - t0; - - if (t0 < *timeout) - *timeout -= t0; - else - *timeout = 0; - } - - return ret; -} diff --git a/network/net_http_special.h b/network/net_http_special.h deleted file mode 100644 index e75c2a5c29..0000000000 --- a/network/net_http_special.h +++ /dev/null @@ -1,33 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2015-2017 - Andre Leiradella - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef __NET_HTTP_SPECIAL_H -#define __NET_HTTP_SPECIAL_H - -#include - -enum -{ - NET_HTTP_GET_OK = 0, - NET_HTTP_GET_MALFORMED_URL, - NET_HTTP_GET_CONNECT_ERROR, - NET_HTTP_GET_TIMEOUT -}; - -int net_http_get(const char **result, size_t *size, - const char *url, retro_time_t *timeout); - -#endif