Have you wasted time on valgrind warnings from code that uses
String:c_ptr instead of String:c_ptr_safe?
Have you fixed bugs caused by the use of String:c_ptr instead of
String::c_ptr_safe?
I have and I am not happy about it. Over on another mailing list I
read about another bug caused by using c_ptr instead of c_ptr_safe. It
wasn't Drizzle, as they appear to have made c_ptr do the right thing.
There are a few changes that can improve this:
1) Add comments to sql_string.h. There are none today in 5.0 and 5.1
in sql_string.h for c_ptr() and c_ptr_unsafe(). I know that using
comments in header files rather than source files has been
controversial in MySQL. AFAIK, that issue is limited to MySQL or ctags
users within MySQL devel. I have never encountered a project where
that wasn't done or at least considered the right thing to do.
2) Change the name of c_ptr as it doesn't return a C pointer to a
string. If it did, the result would be nul terminated and there would
be no need for c_ptr_unsafe.
--
Mark Callaghan
mdcallag@stripped