projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change bluestop link to be https
[fio.git]
/
fifo.c
diff --git
a/fifo.c
b/fifo.c
index 5406aa572199a9c1f59756f3ecfd397c74a07e50..98737e9c8305aa00ea6f21e9a08d2af0b1b97e6f 100644
(file)
--- a/
fifo.c
+++ b/
fifo.c
@@
-15,7
+15,7
@@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc.,
675 Mass Ave, Cambridge, MA 02139
, USA.
+ * Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
, USA.
*
*/
*
*/
@@
-31,11
+31,11
@@
struct fifo *fifo_alloc(unsigned int size)
fifo = malloc(sizeof(struct fifo));
if (!fifo)
fifo = malloc(sizeof(struct fifo));
if (!fifo)
- return
0
;
+ return
NULL
;
fifo->buffer = malloc(size);
fifo->size = size;
fifo->buffer = malloc(size);
fifo->size = size;
- fifo->in = fifo->out = 0
xffff0000
;
+ fifo->in = fifo->out = 0;
return fifo;
}
return fifo;
}
@@
-69,23
+69,23
@@
unsigned int fifo_put(struct fifo *fifo, void *buffer, unsigned int len)
return len;
}
return len;
}
-unsigned int fifo_get(struct fifo *fifo, void *buf
fer
, unsigned int len)
+unsigned int fifo_get(struct fifo *fifo, void *buf, unsigned int len)
{
len = min(len, fifo->in - fifo->out);
{
len = min(len, fifo->in - fifo->out);
- if (buf
fer
) {
+ 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)));
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(buf
fer, 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
*/
/*
* then get the rest (if any) from the beginning of the buffer
*/
- memcpy(buf
fer
+ l, fifo->buffer, len - l);
+ memcpy(buf + l, fifo->buffer, len - l);
}
fifo->out += len;
}
fifo->out += len;