X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fifo.c;h=de0318414ad45aea2ba11326ccf2405756c9c5b1;hp=5406aa572199a9c1f59756f3ecfd397c74a07e50;hb=a1c58075279454a91ec43366846b93e8dcf9753c;hpb=104bc4bdf55bd79c2b3f9087601c3df4aa884b2a;ds=inline diff --git a/fifo.c b/fifo.c index 5406aa57..de031841 100644 --- a/fifo.c +++ b/fifo.c @@ -35,7 +35,7 @@ struct fifo *fifo_alloc(unsigned int size) fifo->buffer = malloc(size); fifo->size = size; - fifo->in = fifo->out = 0xffff0000; + fifo->in = fifo->out = 0; return fifo; } @@ -69,23 +69,23 @@ unsigned int fifo_put(struct fifo *fifo, void *buffer, unsigned int len) return len; } -unsigned int fifo_get(struct fifo *fifo, void *buffer, unsigned int len) +unsigned int fifo_get(struct fifo *fifo, void *buf, unsigned int len) { len = min(len, fifo->in - fifo->out); - if (buffer) { + if (buf) { unsigned int l; /* * first get the data from fifo->out until the end of the buffer */ l = min(len, fifo->size - (fifo->out & (fifo->size - 1))); - memcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)),l); + memcpy(buf, fifo->buffer + (fifo->out & (fifo->size - 1)), l); /* * then get the rest (if any) from the beginning of the buffer */ - memcpy(buffer + l, fifo->buffer, len - l); + memcpy(buf + l, fifo->buffer, len - l); } fifo->out += len;