lishen2 / isotp-c

An implementation of the ISO-TP (ISO15765-2) CAN protocol in C
MIT License
212 stars 79 forks source link

isotp_user_debug() specifies varargs, but then avoids using it #15

Closed j3kestrel closed 2 years ago

j3kestrel commented 4 years ago

isotp_user.h defines isotp_user_debug() to use varargs:

void isotp_user_debug(const char* message, ...);

However, that feature is never used and is avoided in the only case where more than a simple immediate string is sent in isotp.c:isotp_send():

        char message[128];
        sprintf(&message[0], "Attempted to send %d bytes; max size is %d!\n", size, link->send_buf_size);
        isotp_user_debug(message);

If it is preferred to avoid use of varargs, the signature for isotp_user_debug() should not include it. If avoidance is not desired, then isotp_send() should not avoid it?

Preferences?

lishen2 commented 2 years ago

The library is not avoid use of varargs, but we normally don't use varargs to assemble binary messages