src/string.c

changeset 1671
cf19b7820ff0
parent 1668
3ffdfe1776b4
equal deleted inserted replaced
1670:56f55f2f70c0 1671:cf19b7820ff0
642 ctx.delim_more = NULL; 642 ctx.delim_more = NULL;
643 ctx.delim_more_count = 0; 643 ctx.delim_more_count = 0;
644 return ctx; 644 return ctx;
645 } 645 }
646 646
647 bool cx_strtok_next( 647 bool cx_strtok_next_(
648 CxStrtokCtx *ctx, 648 CxStrtokCtx *ctx,
649 cxstring *token 649 cxstring *token
650 ) { 650 ) {
651 // abortion criteria 651 // abortion criteria
652 if (ctx->found >= ctx->limit || ctx->delim_pos >= ctx->str.length) { 652 if (ctx->found >= ctx->limit || ctx->delim_pos >= ctx->str.length) {
683 ctx->str.length : (size_t) (delim.ptr - ctx->str.ptr); 683 ctx->str.length : (size_t) (delim.ptr - ctx->str.ptr);
684 token->length = ctx->delim_pos - ctx->pos; 684 token->length = ctx->delim_pos - ctx->pos;
685 ctx->next_pos = ctx->delim_pos + delim.length; 685 ctx->next_pos = ctx->delim_pos + delim.length;
686 686
687 return true; 687 return true;
688 }
689
690 bool cx_strtok_next_m(
691 CxStrtokCtx *ctx,
692 cxmutstr *token
693 ) {
694 return cx_strtok_next(ctx, (cxstring *) token);
695 } 688 }
696 689
697 void cx_strtok_delim( 690 void cx_strtok_delim(
698 CxStrtokCtx *ctx, 691 CxStrtokCtx *ctx,
699 const cxstring *delim, 692 const cxstring *delim,

mercurial