Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions dstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ static inline void _dstr_set_cap(void* hd,
}
}

static inline void* _dstr_get_hdr_and_type(dstr s, enum dstrhd_type* t_out)
static inline void* _dstr_get_hdr_and_type(dstr restrict s,
enum dstrhd_type* restrict t_out)
{
if (!s)
return NULL;
Expand Down Expand Up @@ -258,7 +259,8 @@ void dstrtrim_base(dstr s)
_dstr_set_len(hd, newlen, t);
}

static inline void _dstr_cutset_bitmap(const char* cutset, uint64_t bitmap[4])
static inline void _dstr_cutset_bitmap(const char* restrict cutset,
uint64_t bitmap[restrict 4])
{
bitmap[0] = bitmap[1] = bitmap[2] = bitmap[3] = 0;
for (const unsigned char* p = (const unsigned char*)cutset; *p; p++)
Expand Down Expand Up @@ -300,7 +302,9 @@ void dstrtrim_custom(dstr s, const char* cutset)
}

// dstrsplit
dstr* dstrsplit(dstr s, const char* delim, size_t* out_count)
dstr* dstrsplit(dstr restrict s,
const char* restrict delim,
size_t* restrict out_count)
{
if (out_count)
*out_count = 0;
Expand Down
4 changes: 3 additions & 1 deletion dstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ void dstrtrim_custom(dstr s, const char* cutset);
* Returns NULL (and *out_count = 0) if s or delim is NULL, delim is
* empty, or on allocation failure. Free the result with dstrsplitfree.
*/
dstr* dstrsplit(dstr s, const char* delim, size_t* out_count) W_UNUSED_RESULT;
dstr* dstrsplit(dstr restrict s,
const char* restrict delim,
size_t* restrict out_count) W_UNUSED_RESULT;

/*
* dstrsplitfree(parts, count)
Expand Down
Loading