diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 18:38:38 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 18:38:38 +0200 |
commit | e16d7dddf1ef1df0c8a00f01fede497521134b74 (patch) | |
tree | 00463bb8d046e99c9d4f4b87c189c347a4bb96c0 /src/input/input_dvb.c | |
parent | 657a953d5d2807ed99eddf7b45a4dc46cef626d5 (diff) | |
download | xine-lib-e16d7dddf1ef1df0c8a00f01fede497521134b74.tar.gz xine-lib-e16d7dddf1ef1df0c8a00f01fede497521134b74.tar.bz2 |
Replace strn?cpy() + strn?cat() calls with a?sprintf().
Instead of creating strings through a series os string copy and
concatenations, use directly the appropriate printf-like function.
Diffstat (limited to 'src/input/input_dvb.c')
-rw-r--r-- | src/input/input_dvb.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index bccbc13be..121e11b11 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -66,14 +66,14 @@ * OSD - this will allow for filtering/searching of epg data - useful for automatic recording :) */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + /* pthread.h must be included first so rest of the headers are imported thread safely (on some systems). */ #include <pthread.h> -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <assert.h> #include <stdio.h> #include <stdlib.h> @@ -3222,21 +3222,19 @@ static char **dvb_class_get_autoplay_list(input_class_t * this_gen, for (ch = 0, apch = !!lastchannel_enable.num_value; ch < num_channels && ch < MAX_AUTOCHANNELS; ++ch, ++apch) { - snprintf(foobuffer, BUFSIZE, "dvb://%s", channels[ch].name); - free(class->autoplaylist[apch]); - class->autoplaylist[apch] = strdup(foobuffer); - _x_assert(class->autoplaylist[apch] != NULL); + free(class->autoplaylist[apch]); + asprintf(&(class->autoplaylist[apch]), "dvb://%s", channels[ch].name); + _x_assert(class->autoplaylist[apch] != NULL); } if (lastchannel_enable.num_value){ + free(class->autoplaylist[0]); if (default_channel != -1) /* plugin has been used before - channel is valid */ - sprintf (foobuffer, "dvb://%s", channels[default_channel].name); + asprintf (&(class->autoplaylist[0]), "dvb://%s", channels[default_channel].name); else /* set a reasonable default - the first channel */ - sprintf (foobuffer, "dvb://%s", num_channels ? channels[0].name : "0"); - free(class->autoplaylist[0]); - class->autoplaylist[0]=strdup(foobuffer); + asprintf (&(class->autoplaylist[0]), "dvb://%s", num_channels ? channels[0].name : "0"); } free_channel_list(channels, num_channels); |