aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-05-24 12:49:23 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-05-28 10:43:39 -0400
commitcb4e165071ad56c4cf881f5221f02eeefde5de53 (patch)
tree0d88bd5e3ebaf53526cda428eebf3d7ad61876bf /src/command.h
parent2a55741ea883e6a9958a64c3463b4c3d60c21b63 (diff)
downloadkutter-cb4e165071ad56c4cf881f5221f02eeefde5de53.tar.gz
kutter-cb4e165071ad56c4cf881f5221f02eeefde5de53.tar.xz
kutter-cb4e165071ad56c4cf881f5221f02eeefde5de53.zip
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>
Diffstat (limited to 'src/command.h')
-rw-r--r--src/command.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/command.h b/src/command.h
index e493c3ee..dd960cdf 100644
--- a/src/command.h
+++ b/src/command.h
@@ -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[];