[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/29] device/cirbuf.c (getc): use char instead of an unsigned ch
From: |
Marin Ramesa |
Subject: |
[PATCH 09/29] device/cirbuf.c (getc): use char instead of an unsigned char |
Date: |
Mon, 9 Dec 2013 23:57:24 +0100 |
I don't understand why nr is a pointer to unsigned char. If it is
a pointer to char, the code is much cleaner.
* device/cirbuf.c (getc) (nr): Use char instead of unsigned char.
(getc) (c_cf, c_cl): Don't cast to (unsigned char *).
(getc) (c_end, c_start): Likewise.
(getc) (nr): Don't cast to (char *).
---
device/cirbuf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/device/cirbuf.c b/device/cirbuf.c
index 292b888..491e89c 100644
--- a/device/cirbuf.c
+++ b/device/cirbuf.c
@@ -103,19 +103,19 @@ int putc(
*/
int getc(struct cirbuf *cb)
{
- unsigned char *nr;
+ char *nr;
int c;
- nr = (unsigned char *)cb->c_cf;
- if (nr == (unsigned char *)cb->c_cl) {
+ nr = cb->c_cf;
+ if (nr == cb->c_cl) {
CB_CHECK(cb);
return -1; /* empty */
}
c = *nr;
nr++;
- if (nr == (unsigned char *)cb->c_end)
- nr = (unsigned char *)cb->c_start;
- cb->c_cf = (char *)nr;
+ if (nr == cb->c_end)
+ nr = cb->c_start;
+ cb->c_cf = nr;
cb->c_cc--;
--
1.8.1.4
- Re: [PATCH 04/29] i386/i386/db_trace.c: use long instead of an int, (continued)
- [PATCH 03/29] i386/i386/db_interface.c: use vm_offset_t instead of an unsigned int, Marin Ramesa, 2013/12/09
- [PATCH 06/29] device/chario.c (char_write): check if io_count is larger or equal to zero and cast it to vm_size_t, Marin Ramesa, 2013/12/09
- [PATCH 07/29] device/chario.c (char_read): check if io_count is larger or equal to zero, Marin Ramesa, 2013/12/09
- [PATCH 08/29] device/chario.c: trivial stylistic fix for consistency, Marin Ramesa, 2013/12/09
- [PATCH 09/29] device/cirbuf.c (getc): use char instead of an unsigned char,
Marin Ramesa <=
- [PATCH 10/29] device/cirbuf.c (cb_alloc): use vm_size_t instead of an int, Marin Ramesa, 2013/12/09
- [PATCH 11/29] device/cirbuf.c (cb_free): use vm_size_t instead of an int, Marin Ramesa, 2013/12/09
- [PATCH 12/29] device/cons.c: fix argument list, Marin Ramesa, 2013/12/09
- [PATCH 13/29] device/dev_pager.c (device_pager_data_request): remove forward declaration, Marin Ramesa, 2013/12/09
- [PATCH 14/29] device/dev_pager.c (device_pager_data_request): cast to (void *) instead to (char *), Marin Ramesa, 2013/12/09
- [PATCH 15/29] device/dev_pager.c (device_pager_data_request_done): check if io_count is larger or equal to zero and cast it to vm_size_t, Marin Ramesa, 2013/12/09
- [PATCH 16/29] device/dev_pager.c (device_pager_data_request_done): check if io_residual is larger or equal to zero and cast it to size_t, Marin Ramesa, 2013/12/09
- [PATCH 17/29] device/dev_pager.c (device_pager_data_request_done): remove unnecessary cast, Marin Ramesa, 2013/12/09