← Back to team overview

maria-developers team mailing list archive

Updated (by Monty): Change to use c_ptr_safe() instead of c_ptr() (62)

 

-----------------------------------------------------------------------
                              WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Change to use c_ptr_safe() instead of c_ptr()
CREATION DATE..: Sat, 07 Nov 2009, 13:14
SUPERVISOR.....: Bothorsen
IMPLEMENTOR....: 
COPIES TO......: 
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 62 (http://askmonty.org/worklog/?tid=62)
VERSION........: Benchmarks-3.0
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 30 (hours remain)
ORIG. ESTIMATE.: 30

PROGRESS NOTES:

-=-=(Monty - Sat, 07 Nov 2009, 13:18)=-=-
High-Level Specification modified.
--- /tmp/wklog.62.old.20510     2009-11-07 11:18:21.000000000 +0000
+++ /tmp/wklog.62.new.20510     2009-11-07 11:18:21.000000000 +0000
@@ -1 +1,9 @@
+What to do:
 
+- Get rid of all \0 terminated strings that we can get rid of (in other words,
+always use String() and change C functions to take string and length).
+- Add a bit to String() that can be set when we initialize the String with a \0
+terminated string.  When the bit is set, we know that c_ptr() is safe to use. 
+- Change to use c_ptr_safe() instead of c_ptr(). (Not that when the has-end-zero
+bit is set we don't have to do an alloc if the whole string is used).
+- Benchmark to see the effects of the above.



DESCRIPTION:

Change to use c_ptr_safe() instead of c_ptr()

This is to avoid possible (but unlikely) problems with disappearing \0 after
usage of c_ptr().

Reasons to do this are:
- Getting rid of some valgrind warnings (where the end \0 was never written).
- It's a gotcha for developers that would use Strings without knowing when
c_ptr() is safe to use.


HIGH-LEVEL SPECIFICATION:



What to do:

- Get rid of all \0 terminated strings that we can get rid of (in other words,
always use String() and change C functions to take string and length).
- Add a bit to String() that can be set when we initialize the String with a \0
terminated string.  When the bit is set, we know that c_ptr() is safe to use. 
- Change to use c_ptr_safe() instead of c_ptr(). (Not that when the has-end-zero
bit is set we don't have to do an alloc if the whole string is used).
- Benchmark to see the effects of the above.


ESTIMATED WORK TIME

ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)