view src/lib/str-sanitize.h @ 22636:96e51a11c0aa

lib: Implement t_strsplit_tabescaped_inplace() This is a more efficient version of t_strsplit_tabescaped(), which modifies the input string instead of duplicating it.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sat, 04 Nov 2017 01:39:38 +0200
parents 081c7da83d8f
children a556724ce39b
line wrap: on
line source

#ifndef STR_SANITIZE_H
#define STR_SANITIZE_H

/* All control characters in src will be appended as '?'. If src is longer
   than max_bytes, it's truncated with "..." appended to the end. Note that
   src is treated as UTF-8 input, but max_bytes is in bytes instead of
   UTF-8 characters. */
void str_sanitize_append(string_t *dest, const char *src, size_t max_bytes);
/* Return src sanitized. If there are no changes, src pointer is returned.
   If src is NULL, returns NULL. */
const char *str_sanitize(const char *src, size_t max_bytes);

#endif