remove memmem

This commit is contained in:
King Kévin 2016-10-04 11:16:13 +02:00
parent 1f895138b1
commit e9489ec910
2 changed files with 0 additions and 39 deletions

View File

@ -33,34 +33,6 @@
volatile bool button_flag = false;
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;
}
char* b2s(uint64_t binary, uint8_t rjust)
{
static char string[64+1] = {0}; // the string representation to return

View File

@ -127,17 +127,6 @@ extern volatile bool button_flag; /**< flag set when board user button has been
/** default printf output */
int _write(int file, char *ptr, int len);
/** find the first occurrence of the byte string s in byte string l
* @copyright 2005 Pascal Gloor <pascal.gloor@spale.com>
* @param[in] l byte string to find byte substring in
* @param[in] l_len length of l byte string
* @param[in] s byte byte substring to find in byte string
* @param[in] s_len length of s byte string
* @return pointer to the beginning of the substring, or NULL if the substring is not found
*/
void * memmem(const void *l, size_t l_len, const void *s, size_t s_len);
/** get binary representation of a number
* @param[in] binary number to represent in binary
* @param[in] rjust justify representation with leading zeros