Remove memmem implementation

Not used after 3bd5e6e5c8
This commit is contained in:
Orestis Floros 2019-10-13 13:10:06 +03:00
parent 5f54971425
commit 70c850ac13
No known key found for this signature in database
GPG Key ID: A09DBD7D3222C1C3
2 changed files with 0 additions and 47 deletions

View File

@ -124,17 +124,6 @@ bool path_exists(const char *path);
*/
void i3_restart(bool forget_layout);
#if defined(__OpenBSD__) || defined(__APPLE__)
/**
* Taken from FreeBSD
* Find the first occurrence of the byte string s in byte string l.
*
*/
void *memmem(const void *l, size_t l_len, const void *s, size_t s_len);
#endif
/**
* Escapes the given string if a pango font is currently used.
* If the string has to be escaped, the input string will be free'd.

View File

@ -312,42 +312,6 @@ void i3_restart(bool forget_layout) {
/* not reached */
}
#if defined(__OpenBSD__) || defined(__APPLE__)
/*
* Taken from FreeBSD
* Find the first occurrence of the byte string s in byte string l.
*
*/
void *memmem(const void *l, size_t l_len, const void *s, size_t s_len) {
register char *cur, *last;
const char *cl = (const char *)l;
const char *cs = (const char *)s;
/* we need something to compare */
if (l_len == 0 || s_len == 0)
return NULL;
/* "s" must be smaller or equal to "l" */
if (l_len < s_len)
return NULL;
/* special case where s_len == 1 */
if (s_len == 1)
return memchr(l, (int)*cs, l_len);
/* the last position where its possible to find "s" in "l" */
last = (char *)cl + l_len - s_len;
for (cur = (char *)cl; cur <= last; cur++)
if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0)
return cur;
return NULL;
}
#endif
/*
* Escapes the given string if a pango font is currently used.
* If the string has to be escaped, the input string will be free'd.