mirror of https://github.com/mpv-player/mpv
Added a function to copy URL.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3041 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
9ea246653a
commit
04178fa6f9
|
@ -104,6 +104,22 @@ url_new(char* url) {
|
|||
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;
|
||||
|
|
|
@ -18,6 +18,7 @@ typedef struct {
|
|||
} URL_t;
|
||||
|
||||
URL_t* url_new(char* url);
|
||||
URL_t* url_copy(URL_t* url);
|
||||
void url_free(URL_t* url);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue