[core] remove redundant asserts
buffer_append_strftime() requires a non-NULL const string for format
buffer_append_string_encoded() and buffer_append_string_c_escaped()
both will handle encoding a 0-length string.  Since a 0-length string
is not expected, do not special-case it.  C type buffer_encoding_t
expects a constant value to be passed, so encoding map is not NULL.
static const char hex_chars_lc[] = "0123456789abcdef";
static const char hex_chars_uc[] = "0123456789ABCDEF";
-/**
- * init the buffer
- *
- */
__attribute_noinline__
buffer* buffer_init(void) {
@@ -334,7 +330,6 @@ void buffer_append_int(buffer *b, intmax_t val) {
}
void buffer_append_strftime(buffer * const restrict b, const char * const restrict format, const struct tm * const restrict tm) {
- force_assert(NULL != format);
/*(localtime_r() or gmtime_r() producing tm should not have failed)*/
if (__builtin_expect( (NULL == tm), 0)) return;
@@ -609,10 +604,6 @@ void buffer_append_string_encoded(buffer * const restrict b, const char * const
size_t d_len, ndx;
const char *map = NULL;
- if (0 == s_len) return;
-
- force_assert(NULL != s);
-
switch(encoding) {
case ENCODING_REL_URI:
map = encoded_chars_rel_uri;
@@ -628,8 +619,6 @@ void buffer_append_string_encoded(buffer * const restrict b, const char * const
break;
}
- force_assert(NULL != map);
-
/* count to-be-encoded-characters */
for (ds = (unsigned char *)s, d_len = 0, ndx = 0; ndx < s_len; ds++, ndx++) {
if (map[*ds & 0xFF]) {
@@ -684,8 +673,6 @@ void buffer_append_string_c_escaped(buffer * const restrict b, const char * cons
unsigned char *ds, *d;
size_t d_len, ndx;
- if (0 == s_len) return;
-
/* count to-be-encoded-characters */
for (ds = (unsigned char *)s, d_len = 0, ndx = 0; ndx < s_len; ds++, ndx++) {
if ((*ds < 0x20) /* control character */
