summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-05-09 17:51:40 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-05-09 17:51:40 +0200
commit902d66eb8304ccffdb683b7130e9f548011b8d30 (patch)
tree9cdd73b5f68131ba2d4944d17e183b4313bdb559 /src/input
parenta51427608e2f4543ae0cb0598517a1e4f6b0928b (diff)
downloadxine-lib-902d66eb8304ccffdb683b7130e9f548011b8d30.tar.gz
xine-lib-902d66eb8304ccffdb683b7130e9f548011b8d30.tar.bz2
Avoid loop for common memory operations (zeroing, copying, moving).
Use the proper function for common memory operations (memset() for zeroing, memcpy() for copying, memmove() for moving), instead of looping through arrays. By extension, remove loops to reset arrays when they were allocated with calloc() and thus already zeroed.
Diffstat (limited to 'src/input')
-rw-r--r--src/input/input_dvb.c6
-rw-r--r--src/input/pnm.c5
2 files changed, 3 insertions, 8 deletions
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index 121e11b11..669cd1e14 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -587,8 +587,7 @@ static tuner_t *tuner_init(xine_t * xine, int adapter)
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "tuner_init adapter=%d\n", adapter);
this->fd_frontend = -1;
- for (x = 0; x < MAX_FILTERS; x++)
- this->fd_pidfilter[x] = 0;
+ memset(this->fd_pidfilter, 0, sizeof(this->fd_pidfilter));
this->xine = xine;
this->adapter_num = adapter;
@@ -933,8 +932,7 @@ static channel_t *load_channels(xine_t *xine, xine_stream_t *stream, int *num_ch
/* Initially there's no EPG data in the EPG structs. */
channels[num_channels].epg_count = 0;
- for (i = 0; i < MAX_EPG_ENTRIES_PER_CHANNEL; ++i)
- channels[num_channels].epg[i] = NULL;
+ memset(channels[num_channels].epg, 0, sizeof(channels[num_channels].epg));
num_channels++;
}
diff --git a/src/input/pnm.c b/src/input/pnm.c
index 47a24a620..5b8aa7c42 100644
--- a/src/input/pnm.c
+++ b/src/input/pnm.c
@@ -631,10 +631,7 @@ static int pnm_get_stream_chunk(pnm_t *p) {
*/
n=0;
while (p->buffer[0] != 0x5a) {
- int i;
- for (i=1; i<8; i++) {
- p->buffer[i-1]=p->buffer[i];
- }
+ memmove(p->buffer, &p->buffer[1], 8);
_x_io_tcp_read (p->stream, p->s, &p->buffer[7], 1);
n++;
}