Skip to content

Commit

Permalink
prioritize windows builds that work now not vcpkg pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
agl-alexglopez committed Jul 12, 2024
1 parent 1468a27 commit 9dcbcfd
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 45 deletions.
42 changes: 21 additions & 21 deletions str_view/str_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ static size_t sv_rfourbyte_strnstrn(const unsigned char *, size_t,

#if defined(_MSC_VER)
str_view
sv(const char *str)
sv(const char str[1])
#else
str_view
sv(const char str[1])
sv(const char str[static const 1])
#endif
{
if (!str)
Expand All @@ -102,10 +102,10 @@ sv(const char str[1])

#if defined(_MSC_VER)
str_view
sv_n(size_t n, const char *str)
sv_n(size_t n, const char str[1])
#else
str_view
sv_n(size_t n, const char str[1])
sv_n(size_t n, const char str[static const 1])
#endif
{
if (!str || !n)
Expand All @@ -117,10 +117,10 @@ sv_n(size_t n, const char str[1])

#if defined(_MSC_VER)
str_view
sv_delim(const char *str, const char *delim)
sv_delim(const char str[1], const char delim[1])
#else
str_view
sv_delim(const char str[1], const char delim[1])
sv_delim(const char str[static const 1], const char delim[static const 1])
#endif
{
if (!str)
Expand Down Expand Up @@ -156,21 +156,21 @@ sv_print(FILE *f, str_view sv)

#if defined(_MSC_VER)
str_view
sv_copy(const size_t str_sz, const char *src_str)
sv_copy(const size_t str_sz, const char src_str[1])
#else
str_view
sv_copy(const size_t str_sz, const char src_str[1])
sv_copy(const size_t str_sz, const char src_str[static const 1])
#endif
{
return sv_n(str_sz, src_str);
}

#if defined(_MSC_VER)
size_t
sv_fill(size_t dest_sz, char *dest_buf, str_view src)
sv_fill(size_t dest_sz, char dest_buf[1], str_view src)
#else
size_t
sv_fill(size_t dest_sz, char dest_buf[1], str_view src)
sv_fill(size_t dest_sz, char dest_buf[dest_sz], str_view src)
#endif
{
if (!dest_buf || !dest_sz || !src.s || !src.sz)
Expand Down Expand Up @@ -203,10 +203,10 @@ sv_size(str_view sv)

#if defined(_MSC_VER)
size_t
sv_strsize(const char *str)
sv_strsize(const char str[1])
#else
size_t
sv_strsize(const char str[1])
sv_strsize(const char str[static const 1])
#endif
{
if (!str)
Expand All @@ -218,10 +218,10 @@ sv_strsize(const char str[1])

#if defined(_MSC_VER)
size_t
sv_minlen(const char *str, size_t n)
sv_minlen(const char str[1], size_t n)
#else
size_t
sv_minlen(const char str[1], size_t n)
sv_minlen(const char str[static const 1], size_t n)
#endif
{
if (!str)
Expand Down Expand Up @@ -285,10 +285,10 @@ sv_cmp(str_view lhs, str_view rhs)

#if defined(_MSC_VER)
sv_threeway_cmp
sv_strcmp(str_view lhs, const char *rhs)
sv_strcmp(str_view lhs, const char rhs[1])
#else
sv_threeway_cmp
sv_strcmp(str_view lhs, const char rhs[1])
sv_strcmp(str_view lhs, const char rhs[static const 1])
#endif
{
if (!lhs.s || !rhs)
Expand All @@ -312,10 +312,10 @@ sv_strcmp(str_view lhs, const char rhs[1])

#if defined(_MSC_VER)
sv_threeway_cmp
sv_strncmp(str_view lhs, const char *rhs, const size_t n)
sv_strncmp(str_view lhs, const char rhs[1], const size_t n)
#else
sv_threeway_cmp
sv_strncmp(str_view lhs, const char rhs[1], const size_t n)
sv_strncmp(str_view lhs, const char rhs[static const 1], const size_t n)
#endif
{
if (!lhs.s || !rhs)
Expand Down Expand Up @@ -383,7 +383,7 @@ const char *
sv_next(const char c[1])
#else
const char *
sv_next(const char c[1])
sv_next(const char c[static 1])
#endif
{
if (!c)
Expand Down Expand Up @@ -423,10 +423,10 @@ sv_rend(str_view sv)

#if defined(_MSC_VER)
const char *
sv_rnext(const char *c)
sv_rnext(const char c[1])
#else
const char *
sv_rnext(const char c[1])
sv_rnext(const char c[static 1])
#endif
{
if (!c)
Expand Down
51 changes: 27 additions & 24 deletions str_view/str_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,24 @@ typedef enum
#if defined(_MSC_VER)
/* Constructs and returns a string view from a NULL TERMINATED string.
It is undefined to construct a str_view from a non terminated string. */
str_view sv(const char *str);
str_view sv(const char str[1]);
#else
/* Constructs and returns a string view from a NULL TERMINATED string.
It is undefined to construct a str_view from a non terminated string. */
str_view sv(const char str[1]) ATTRIB_NONNULL(1) ATTRIB_NULLTERM(1) ATTRIB_PURE;
str_view sv(const char str[static const 1]) ATTRIB_NONNULL(1)
ATTRIB_NULLTERM(1) ATTRIB_PURE;
#endif

#if defined(_MSC_VER)
/* Constructs and returns a string view from a sequence of valid n bytes
or string length, whichever comes first. The resulting str_view may
or may not be null terminated at the index of its size. */
str_view sv_n(size_t n, const char *str);
str_view sv_n(size_t n, const char str[1]);
#else
/* Constructs and returns a string view from a sequence of valid n bytes
or string length, whichever comes first. The resulting str_view may
or may not be null terminated at the index of its size. */
str_view sv_n(size_t n, const char str[1]) ATTRIB_NONNULL(2)
str_view sv_n(size_t n, const char str[static const 1]) ATTRIB_NONNULL(2)
ATTRIB_NULLTERM(2) ATTRIB_PURE;
#endif

Expand All @@ -122,14 +123,15 @@ str_view sv_n(size_t n, const char str[1]) ATTRIB_NONNULL(2)
terminator if delim cannot be found. This constructor will also
skip the delimeter if that delimeter starts the string. This is similar
to the tokenizing function in the iteration section. */
str_view sv_delim(const char *str, const char *delim);
str_view sv_delim(const char str[1], const char delim[1]);
#else
/* Constructs and returns a string view from a NULL TERMINATED string
broken on the first ocurrence of delimeter if found or null
terminator if delim cannot be found. This constructor will also
skip the delimeter if that delimeter starts the string. This is similar
to the tokenizing function in the iteration section. */
str_view sv_delim(const char str[1], const char delim[1]) ATTRIB_NONNULL(1, 2)
str_view sv_delim(const char str[static const 1],
const char delim[static const 1]) ATTRIB_NONNULL(1, 2)
ATTRIB_NULLTERM(1, 2) ATTRIB_PURE;
#endif

Expand Down Expand Up @@ -170,10 +172,10 @@ size_t sv_size(str_view sv) ATTRIB_CONST;

#if defined(_MSC_VER)
/* Returns the bytes of the string pointer to, null terminator included. */
size_t sv_strsize(const char *str);
size_t sv_strsize(const char str[1]);
#else
/* Returns the bytes of the string pointer to, null terminator included. */
size_t sv_strsize(const char str[1]) ATTRIB_NONNULL(1)
size_t sv_strsize(const char str[static const 1]) ATTRIB_NONNULL(1)
ATTRIB_NULLTERM(1) ATTRIB_PURE;
#endif

Expand All @@ -184,26 +186,26 @@ void sv_swap(str_view *a, str_view *b) ATTRIB_NONNULL(1, 2);
#if defined(_MSC_VER)
/* Copies the max of str_sz or src_str length into a view, whichever
ends first. This is the same as sv_n. */
str_view sv_copy(size_t str_sz, const char *src_str);
str_view sv_copy(size_t str_sz, const char src_str[1]);
#else
/* Copies the max of str_sz or src_str length into a view, whichever
ends first. This is the same as sv_n. */
str_view sv_copy(size_t str_sz, const char src_str[1]) ATTRIB_NONNULL(2)
ATTRIB_NULLTERM(1) ATTRIB_PURE;
str_view sv_copy(size_t str_sz, const char src_str[static const 1])
ATTRIB_NONNULL(2) ATTRIB_NULLTERM(1) ATTRIB_PURE;
#endif

#if defined(_MSC_VER)
/* Fills the destination buffer with the minimum between
destination size and source view size, null terminating
the string. This may cut off src data if dest_sz < src.sz.
Returns how many bytes were written to the buffer. */
size_t sv_fill(size_t dest_sz, char *dest_buf, str_view src);
size_t sv_fill(size_t dest_sz, char dest_buf[1], str_view src);
#else
/* Fills the destination buffer with the minimum between
destination size and source view size, null terminating
the string. This may cut off src data if dest_sz < src.sz.
Returns how many bytes were written to the buffer. */
size_t sv_fill(size_t dest_sz, char dest_buf[1], str_view src)
size_t sv_fill(size_t dest_sz, char dest_buf[dest_sz], str_view src)
ATTRIB_NONNULL(2);
#endif

Expand Down Expand Up @@ -246,8 +248,8 @@ sv_threeway_cmp sv_strcmp(str_view lhs, const char *rhs);
Comparison is bounded by the shorter str_view length. ERR is
returned if bad input is provided such as a str_view with a
NULL pointer field. */
sv_threeway_cmp sv_strcmp(str_view lhs, const char rhs[1]) ATTRIB_NONNULL(2)
ATTRIB_NULLTERM(2) ATTRIB_PURE;
sv_threeway_cmp sv_strcmp(str_view lhs, const char rhs[static const 1])
ATTRIB_NONNULL(2) ATTRIB_NULLTERM(2) ATTRIB_PURE;
#endif

#if defined(_MSC_VER)
Expand All @@ -260,7 +262,7 @@ sv_threeway_cmp sv_strcmp(str_view lhs, const char rhs[1]) ATTRIB_NONNULL(2)
Comparison is bounded by the shorter str_view length. ERR is
returned if bad input is provided such as a str_view with a
NULL pointer field. */
sv_threeway_cmp sv_strncmp(str_view lhs, const char *rhs, size_t n);
sv_threeway_cmp sv_strncmp(str_view lhs, const char rhs[1], size_t n);
#else
/* Returns the standard C threeway comparison between cmp(lhs, rhs)
between a str_view and the first n bytes (inclusive) of str
Expand All @@ -271,16 +273,17 @@ sv_threeway_cmp sv_strncmp(str_view lhs, const char *rhs, size_t n);
Comparison is bounded by the shorter str_view length. ERR is
returned if bad input is provided such as a str_view with a
NULL pointer field. */
sv_threeway_cmp sv_strncmp(str_view lhs, const char rhs[1], size_t n)
ATTRIB_NONNULL(2) ATTRIB_NULLTERM(2) ATTRIB_PURE;
sv_threeway_cmp sv_strncmp(str_view lhs, const char rhs[static const 1],
size_t n) ATTRIB_NONNULL(2)
ATTRIB_NULLTERM(2) ATTRIB_PURE;
#endif

#if defined(_MSC_VER)
/* Returns the minimum between the string size vs n bytes. */
size_t sv_minlen(const char *str, size_t n);
size_t sv_minlen(const char str[1], size_t n);
#else
/* Returns the minimum between the string size vs n bytes. */
size_t sv_minlen(const char str[1], size_t n) ATTRIB_NONNULL(1)
size_t sv_minlen(const char str[static const 1], size_t n) ATTRIB_NONNULL(1)
ATTRIB_NULLTERM(1) ATTRIB_PURE;
#endif

Expand Down Expand Up @@ -373,11 +376,11 @@ const char *sv_end(str_view sv) ATTRIB_PURE;
#if defined(_MSC_VER)
/* Advances the pointer from its previous position. If NULL is provided
sv_null() is returned. */
const char *sv_next(const char *c);
const char *sv_next(const char c[1]);
#else
/* Advances the pointer from its previous position. If NULL is provided
sv_null() is returned. */
const char *sv_next(const char c[1]) ATTRIB_NONNULL(1)
const char *sv_next(const char c[static 1]) ATTRIB_NONNULL(1)
ATTRIB_NULLTERM(1) ATTRIB_PURE;
#endif

Expand All @@ -398,13 +401,13 @@ const char *sv_rend(str_view sv) ATTRIB_PURE;
being iterated through in reverse. It is undefined behavior
to change the str_view one is iterating through during
iteration. If the char pointer is null, sv_null() is returned. */
const char *sv_rnext(const char *c);
const char *sv_rnext(const char c[1]);
#else
/* Advances the iterator to the next character in the str_view
being iterated through in reverse. It is undefined behavior
to change the str_view one is iterating through during
iteration. If the char pointer is null, sv_null() is returned. */
const char *sv_rnext(const char c[1]) ATTRIB_NONNULL(1) ATTRIB_PURE;
const char *sv_rnext(const char c[static 1]) ATTRIB_NONNULL(1) ATTRIB_PURE;
#endif

/* Returns the character pointer at the minimum between the indicated
Expand Down

0 comments on commit 9dcbcfd

Please sign in to comment.