Another macro usage

Used same macro instead of array
pull/49/head
Heydar Elahi 2017-08-09 11:56:05 +04:30
parent 23249c5cd8
commit 1ae8714d0d
1 changed files with 2 additions and 2 deletions

4
lib.c
View File

@ -270,7 +270,7 @@ void sprint_canframe(char *buf , struct canfd_frame *cf, int sep, int maxdlen) {
buf[offset++] = 'R'; buf[offset++] = 'R';
/* print a given CAN 2.0B DLC if it's not zero */ /* print a given CAN 2.0B DLC if it's not zero */
if (cf->len && cf->len <= CAN_MAX_DLC) if (cf->len && cf->len <= CAN_MAX_DLC)
buf[offset++] = hex_asc_upper[cf->len & 0xF]; buf[offset++] = hex_asc_upper_lo(cf->len);
buf[offset] = 0; buf[offset] = 0;
return; return;
@ -279,7 +279,7 @@ void sprint_canframe(char *buf , struct canfd_frame *cf, int sep, int maxdlen) {
if (maxdlen == CANFD_MAX_DLEN) { if (maxdlen == CANFD_MAX_DLEN) {
/* add CAN FD specific escape char and flags */ /* add CAN FD specific escape char and flags */
buf[offset++] = '#'; buf[offset++] = '#';
buf[offset++] = hex_asc_upper[cf->flags & 0xF]; buf[offset++] = hex_asc_upper_lo(cf->flags);
if (sep && len) if (sep && len)
buf[offset++] = '.'; buf[offset++] = '.';
} }