优化
This commit is contained in:
@@ -392,6 +392,9 @@ unsigned long fifo_strtoul(fifo_t* self, os_size_t* endptr /*从哪里开始转
|
|||||||
|
|
||||||
// Returns the virtual index relative to tail where the match starts, or -1 if not found
|
// Returns the virtual index relative to tail where the match starts, or -1 if not found
|
||||||
os_size_t fifo_strstr(fifo_t *self, const char *search) {
|
os_size_t fifo_strstr(fifo_t *self, const char *search) {
|
||||||
|
|
||||||
|
if(self==NULL || search==NULL || search[0]=='\0') return FIFO_INVALID_POS;
|
||||||
|
|
||||||
os_size_t search_len = strlen(search);
|
os_size_t search_len = strlen(search);
|
||||||
os_size_t count = fifo_count(self);
|
os_size_t count = fifo_count(self);
|
||||||
if (search_len == 0 || count < search_len) return FIFO_INVALID_POS;
|
if (search_len == 0 || count < search_len) return FIFO_INVALID_POS;
|
||||||
|
|||||||
Reference in New Issue
Block a user