Browse Source

[core] remove now-unused buffer_search_string_len

(just use strstr(), if desired)
personal/stbuehler/mod-csrf
Glenn Strauss 5 years ago
parent
commit
a22c126323
  1. 16
      src/buffer.c
  2. 2
      src/buffer.h

16
src/buffer.c

@ -377,22 +377,6 @@ char hex2int(unsigned char hex) {
return value;
}
char * buffer_search_string_len(buffer *b, const char *needle, size_t len) {
size_t i;
force_assert(NULL != b);
force_assert(0 != len && NULL != needle); /* empty needles not allowed */
if (b->used < len) return NULL;
for(i = 0; i < b->used - len; i++) {
if (0 == memcmp(b->ptr + i, needle, len)) {
return b->ptr + i;
}
}
return NULL;
}
int buffer_is_empty(const buffer *b) {
return NULL == b || 0 == b->used;
}

2
src/buffer.h

@ -101,8 +101,6 @@ void li_utostrn(char *buf, size_t buf_len, uintmax_t val);
/* buf must be (at least) 2*s_len + 1 big. uses lower-case hex letters. */
void li_tohex(char *buf, size_t buf_len, const char *s, size_t s_len);
char * buffer_search_string_len(buffer *b, const char *needle, size_t len);
/* NULL buffer or empty buffer (used == 0);
* unset "string" (buffer) config options are initialized to used == 0,
* while setting an empty string leads to used == 1

Loading…
Cancel
Save