Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
golf
Browse files Browse the repository at this point in the history
charlesnicholson committed Dec 28, 2023
1 parent 2f790ee commit 8720517
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions cobs.c
Original file line number Diff line number Diff line change
@@ -224,21 +224,14 @@ cobs_ret_t cobs_decode_inc(cobs_decode_ctx_t *ctx, cobs_decode_args_t *args) {
cobs_byte_t const *src_b = (cobs_byte_t const *)args->src;
cobs_byte_t *dst_b = (cobs_byte_t *)args->dst;

for (;;) {
while (src_idx < args->src_max) {
switch (ctx->state) {
case COBS_DECODE_READ_CODE: {
if (src_idx >= args->src_max) {
goto done;
}

ctx->block = ctx->code = src_b[src_idx++];
ctx->state = COBS_DECODE_RUN;
} break;

case COBS_DECODE_FINISH_RUN: {
if (src_idx >= args->src_max) {
goto done;
}
if (!src_b[src_idx]) {
args->decode_complete = 1;
goto done;

0 comments on commit 8720517

Please sign in to comment.