26 Jul
2004
26 Jul
'04
7:27 p.m.
On Sun, 2004-07-25 at 15:40, Joshua Goodall wrote:
I fleshed this out a bit. OK, a lot, because this was done to improve interoperability with OpenLDAP. The attached diff:
Committed with a few minor changes. And btw:
+#define STRWIPE(s) do { \
- char *c; \
- for (c = s; *c != '\0'; c++) \
+} while (0)*c = '\0'; \
safe_memset() exists pretty much for this reason. Compilers may sooner or later optimize out this kind of code because it seems useless to it. Microsoft's compilers already do in some cases.
Of course there could be safe_strwipe() to avoid extra strlen() call but it's a bit unnecessary optimization IMHO :)