diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2004-10-20 09:12:17 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2004-10-20 09:12:17 +0000 |
commit | 65f9c5e8d026830b0fbd2583007c507e5e6e2b78 (patch) | |
tree | 90b7edde9cf164b845ce49afe2f768bc649c7436 | |
parent | 9de90f94662f19eac829fd9c2396adcc5319bfbc (diff) | |
download | fetchmail-65f9c5e8d026830b0fbd2583007c507e5e6e2b78.tar.gz fetchmail-65f9c5e8d026830b0fbd2583007c507e5e6e2b78.tar.bz2 fetchmail-65f9c5e8d026830b0fbd2583007c507e5e6e2b78.zip |
(rfc2047e) Convenience: free the buffer ourselves rather than let the caller to it.
svn path=/trunk/; revision=3952
-rw-r--r-- | rfc2047e.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -75,14 +75,23 @@ static char *encode_words(char *const *words, int nwords, const char *charset) return out; } +/** RFC-2047 encode string with given charset. Only the Q encoding + * (quoted-printable) supported at this time. + * WARNING: this code returns a static buffer! + */ char *rfc2047e(const char *string, const char *charset) { - char *t, *out; + static char *out; + char *t; const char *r; int count, minlen, idx, i; char **words = NULL; size_t l; assert(strlen(charset) < 40); + if (out) { + free(out); + out = NULL; + } /* phase 1: split original into words */ /* 1a: count, 1b: copy */ |