Skip to content

Missing strnlen() on MingW #60

Closed
Closed

Description

@gvanem

MingW doesn't have strnlen() which is needed in sniffer.c + snifftest.c. To solve it, I added this to my config.h:

    extern __inline__ size_t strnlen (const char *str, size_t maxsize)
    {
      size_t n;
      for (n = 0; n < maxsize && *str; n++, str++)
        ;
      return (n);
    }

Maybe the missing functions (strnlen, strsep) could be added to a more suitable place?

Activity

  1. ejohnstown commented on Mar 31, 2015

    @ejohnstown
    Contributor

    I replaced the call to strnlen() with strlen() and did my size check separately. strnlen() isn't very portable, as you found, so we shouldn't use it.

  2. added a commit that references this issue on Mar 4, 2022
  3. added a commit that references this issue on Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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