command: Don't pass max_size to command_encodef()

The command_encodef() can read the max_size parameter directly from
the 'struct command_encoder' passed into it.  Also, there is no need
to check that a message will fit in a buffer if the buffer is declared
to be MESSAGE_MAX in size.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-08-13 16:48:27 -04:00
parent f3da473285
commit f8bd8b97be
7 changed files with 24 additions and 29 deletions

View file

@ -63,8 +63,8 @@ enum {
// command.c
char *command_parsef(char *p, char *maxend
, const struct command_parser *cp, uint32_t *args);
uint8_t command_encodef(char *buf, uint8_t buf_len
, const struct command_encoder *ce, va_list args);
uint8_t command_encodef(char *buf, const struct command_encoder *ce
, va_list args);
void command_sendf(const struct command_encoder *ce, ...);
void command_add_frame(char *buf, uint8_t msglen);
int8_t command_find_block(char *buf, uint8_t buf_len, uint8_t *pop_count);