[PATCH v1] buffer: Remove some useless casts on BLAST returns
Gert Doering <[email protected]>
| Newsgroups | gmane.network.openvpn.devel |
|---|---|
| Message-ID | <[email protected]> |
From: Frank Lichtenheld <[email protected]> We can compare to '\0' without having to do casting. Change-Id: I450568c0307a6372506d115cb389d172472140d4 Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Razvan Cojocaru <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1845 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1845 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru <[email protected]> diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index bf38c68..87d3094 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -500,7 +500,7 @@ void buf_null_terminate(struct buffer *buf) { - const char *last = (char *)BLAST(buf); + const uint8_t *last = BLAST(buf); if (last && *last == '\0') /* already terminated? */ { return; @@ -523,12 +523,12 @@ { while (true) { - const char *last = (char *)BLAST(buf); + const uint8_t *last = BLAST(buf); if (!last) { break; } - if (char_class((unsigned char)*last, CC_CRLF | CC_NULL)) + if (char_class(*last, CC_CRLF | CC_NULL)) { if (!buf_inc_len(buf, -1)) {