Skip to content

Consolidate decimal digit -> str functions in tokenizer.c #62717

@WillAyd

Description

@WillAyd

@Alvaro-Kothe implemented a really nice PR in #62658 (comment) with a copy_string_without_char function to remove the separator from a numeric string

We also have a function _str_copy_decimal_str_c at

static char *_str_copy_decimal_str_c(const char *s, char **endpos, char decimal,
that is similar, but:

  • allocates a buffer on the heap
  • supports replacement of multiple characters
  • reads and writes per-byte

It would be nice to combine both of these functions into one and take advantage of their individual strengths, utlimately getting a function that can replace multiple characters into a caller-provided buffer (ideally on the stack), and which moves blocks of memory instead of individual characters, where applicable.

strtok_s / strtok seem like they could be really useful here, or alternatively strpbrk

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions