Mercurial > mplayer.hg
changeset 35317:aa2026fd0c76
Remove pointless local variable.
author | reimar |
---|---|
date | Sat, 10 Nov 2012 14:53:11 +0000 |
parents | 18fdd24d97ff |
children | 249053c3da2b |
files | stream/http.c |
diffstat | 1 files changed, 5 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/stream/http.c Sat Nov 10 14:45:56 2012 +0000 +++ b/stream/http.c Sat Nov 10 14:53:11 2012 +0000 @@ -453,25 +453,19 @@ char * http_build_request( HTTP_header_t *http_hdr ) { - char *ptr, *uri=NULL; + char *ptr; int len; HTTP_field_t *field; if( http_hdr==NULL ) return NULL; if( http_hdr->method==NULL ) http_set_method( http_hdr, "GET"); if( http_hdr->uri==NULL ) http_set_uri( http_hdr, "/"); - else { - uri = malloc(strlen(http_hdr->uri) + 1); - if( uri==NULL ) { - mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MemAllocFailed); - return NULL; - } - strcpy(uri,http_hdr->uri); - } + if( !http_hdr->uri || !http_hdr->method) + return NULL; //**** Compute the request length // Add the Method line - len = strlen(http_hdr->method)+strlen(uri)+12; + len = strlen(http_hdr->method)+strlen(http_hdr->uri)+12; // Add the fields field = http_hdr->first_field; while( field!=NULL ) { @@ -499,7 +493,7 @@ //*** Building the request ptr = http_hdr->buffer; // Add the method line - ptr += sprintf( ptr, "%s %s HTTP/1.%d\r\n", http_hdr->method, uri, http_hdr->http_minor_version ); + ptr += sprintf( ptr, "%s %s HTTP/1.%d\r\n", http_hdr->method, http_hdr->uri, http_hdr->http_minor_version ); field = http_hdr->first_field; // Add the field while( field!=NULL ) { @@ -512,7 +506,6 @@ memcpy( ptr, http_hdr->body, http_hdr->body_size ); } - free(uri); return http_hdr->buffer; }