command: Prefer uint8_t* for buffers; prefer uint8_fast_t for lengths

Prefer using 'uint8_t' buffers as it is too easy to run into C sign
extension problems with 'char' buffers.  Prefer using 'uint_fast8_t'
for buffer lengths as gcc does a better job compiling them on 32bit
mcus.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-05-24 12:49:23 -04:00
parent 2a55741ea8
commit cb4e165071
11 changed files with 71 additions and 78 deletions

View file

@ -61,14 +61,15 @@ enum {
};
// command.c
char *command_parsef(char *p, char *maxend
, const struct command_parser *cp, uint32_t *args);
uint8_t command_encodef(char *buf, const struct command_encoder *ce
, va_list args);
uint8_t *command_parsef(uint8_t *p, uint8_t *maxend
, const struct command_parser *cp, uint32_t *args);
uint_fast8_t command_encodef(uint8_t *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);
void command_dispatch(char *buf, uint8_t msglen);
void command_add_frame(uint8_t *buf, uint_fast8_t msglen);
int_fast8_t command_find_block(uint8_t *buf, uint_fast8_t buf_len
, uint_fast8_t *pop_count);
void command_dispatch(uint8_t *buf, uint_fast8_t msglen);
// out/compile_time_request.c (auto generated file)
extern const struct command_parser command_index[];