changeset 3040:9fad4017ec37

Added a function to copy URL.
author bertrand
date Tue, 20 Nov 2001 22:15:32 +0000
parents 80189681c02b
children 6b31e121f36a
files libmpdemux/url.c libmpdemux/url.h
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/url.c	Tue Nov 20 22:14:16 2001 +0000
+++ b/libmpdemux/url.c	Tue Nov 20 22:15:32 2001 +0000
@@ -104,6 +104,22 @@
 	return Curl;
 }
 
+URL_t *
+url_copy(URL_t* url) {
+	URL_t *dup_url;
+
+	if( url==NULL ) return NULL;
+	dup_url = (URL_t*)malloc(sizeof(URL_t));
+	if( dup_url==NULL ) {
+		printf("Memory allocation failed!\n");
+		return NULL;
+	}
+	memcpy( dup_url, url, sizeof(URL_t) );
+	
+	return dup_url;
+}
+
+
 void
 url_free(URL_t* url) {
 	if(!url) return;
--- a/libmpdemux/url.h	Tue Nov 20 22:14:16 2001 +0000
+++ b/libmpdemux/url.h	Tue Nov 20 22:15:32 2001 +0000
@@ -18,6 +18,7 @@
 } URL_t;
 
 URL_t* url_new(char* url);
+URL_t* url_copy(URL_t* url);
 void   url_free(URL_t* url);
 
 #endif