[pacman-dev] [PATCH 1/1] dload: mark final_url as const

Christian Hesse list at eworm.de
Thu Oct 16 13:36:55 UTC 2014


From: Christian Hesse <mail at eworm.de>

---
 lib/libalpm/be_sync.c | 3 +--
 lib/libalpm/dload.c   | 8 ++++----
 lib/libalpm/dload.h   | 2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 6572a8a..62fd0f0 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -209,8 +209,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
 	}
 
 	for(i = db->servers; i; i = i->next) {
-		char *final_db_url = NULL;
-		const char *server = i->data;
+		const char *server = i->data, *final_db_url = NULL;
 		struct dload_payload payload;
 		size_t len;
 		int sig_ret = 0;
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 43c1503..e3409f9 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -388,7 +388,7 @@ static FILE *create_tempfile(struct dload_payload *payload, const char *localpat
 #define HOSTNAME_SIZE 256
 
 static int curl_download_internal(struct dload_payload *payload,
-		const char *localpath, char **final_file, char **final_url)
+		const char *localpath, char **final_file, const char **final_url)
 {
 	int ret = -1;
 	FILE *localf = NULL;
@@ -622,7 +622,7 @@ cleanup:
  * @return 0 on success, -1 on error (pm_errno is set accordingly if errors_ok == 0)
  */
 int _alpm_download(struct dload_payload *payload, const char *localpath,
-		char **final_file, char **final_url)
+		char **final_file, const char **final_url)
 {
 	alpm_handle_t *handle = payload->handle;
 
@@ -664,8 +664,8 @@ static char *filecache_find_url(alpm_handle_t *handle, const char *url)
 char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url)
 {
 	char *filepath;
-	const char *cachedir;
-	char *final_file = NULL, *final_pkg_url = NULL;
+	const char *cachedir, *final_pkg_url = NULL;
+	char *final_file = NULL;
 	struct dload_payload payload;
 	int ret = 0;
 
diff --git a/lib/libalpm/dload.h b/lib/libalpm/dload.h
index 10c586e..512a376 100644
--- a/lib/libalpm/dload.h
+++ b/lib/libalpm/dload.h
@@ -49,7 +49,7 @@ struct dload_payload {
 void _alpm_dload_payload_reset(struct dload_payload *payload);
 
 int _alpm_download(struct dload_payload *payload, const char *localpath,
-		char **final_file, char **final_url);
+		char **final_file, const char **final_url);
 
 #endif /* _ALPM_DLOAD_H */
 
-- 
2.1.2


More information about the pacman-dev mailing list