diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-18 21:53:57 +0100 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-18 21:53:57 +0100 |
commit | a87b60337712543a6f715b45c80affbdc5ba520a (patch) | |
tree | 9d4b1e68ad2227d6139696137358a65591b8c56d /src | |
parent | a365222f0200a3f5437a601b06791eb7c03ff4e3 (diff) | |
download | xine-lib-a87b60337712543a6f715b45c80affbdc5ba520a.tar.gz xine-lib-a87b60337712543a6f715b45c80affbdc5ba520a.tar.bz2 |
Use asprintf where possible.
Diffstat (limited to 'src')
-rw-r--r-- | src/input/librtsp/rtsp.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index 236dbc41e..b6dad6a31 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -21,6 +21,8 @@ * *not* RFC 2326 compilant yet. */ +#include <config.h> + #include <unistd.h> #include <stdio.h> #include <assert.h> @@ -294,8 +296,7 @@ int rtsp_request_options(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf = malloc(sizeof(char)*(strlen(s->host)+16)); - sprintf(buf,"rtsp://%s:%i", s->host, s->port); + asprintf(&buf,"rtsp://%s:%i", s->host, s->port); } rtsp_send_request(s,"OPTIONS",buf); free(buf); @@ -311,8 +312,7 @@ int rtsp_request_describe(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); - sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); + asprintf(&buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"DESCRIBE",buf); free(buf); @@ -335,8 +335,7 @@ int rtsp_request_setparameter(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); - sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); + asprintf(&buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"SET_PARAMETER",buf); free(buf); @@ -352,8 +351,7 @@ int rtsp_request_play(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); - sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); + asprintf(&buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"PLAY",buf); free(buf); @@ -402,8 +400,7 @@ int rtsp_read_data(rtsp_t *s, void *buffer_gen, unsigned int size) { } /* lets make the server happy */ rtsp_put(s, "RTSP/1.0 451 Parameter Not Understood"); - rest = malloc(sizeof(char)*17); - sprintf(rest,"CSeq: %u", seq); + asprintf(&rest,"CSeq: %u", seq); rtsp_put(s, rest); free(rest); rtsp_put(s, ""); |