+2003-08-25 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * flower/include/string-handle.icc: formatting cleanups, rename
+ references by ref_count_.
+
2003-08-23 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* scripts/convert-ly.py (FatalConversionError.conv): typo
INLINE void
String_data::OKW ()
{
- assert (references == 1);
+ assert (ref_count_ == 1);
}
INLINE void
{
assert (maxlen >= length_);
assert (bool (data_byte_));
- assert (references >= 1);
+ assert (ref_count_ >= 1);
}
INLINE
String_data::String_data ()
{
- references=0;
+ ref_count_=0;
maxlen = INITIALMAX;
data_byte_ = new Byte[maxlen + 1];
data_byte_[0] = 0;
INLINE
String_data::String_data (String_data const &src)
{
- references=0;
+ ref_count_=0;
maxlen = length_ = src.length_;
data_byte_ = new Byte[maxlen+1]; // should calc GNU 8byte overhead.
memcpy (data_byte_, src.data_byte_, length_ + 1);
INLINE
String_data::~String_data ()
{
- assert (references == 0);
+ assert (ref_count_ == 0);
delete[] data_byte_;
}
OKW ();
if (j > maxlen)
{
- delete data_byte_;
+ delete[] data_byte_;
maxlen = j;
data_byte_ = new Byte[maxlen + 1];
void up (String_data *d);
/** make sure data has only one reference.
- POST: data->references == 1
+ POST: data->ref_count_ == 1
*/
void copy ();
INLINE void
String_handle::down ()
{
- if (! (--data->references)) delete data; data = 0;
+ if (! (--data->ref_count_))
+ delete data;
+ data = 0;
}
-/// increase ref count
+/*
+ increase ref count
+
+ THIS does not have to be initialized.
+*/
+
INLINE void
String_handle::up (String_data *d)
{
- data=d; data->references ++;
+ data=d;
+ data->ref_count_ ++;
}
INLINE void
String_handle::copy ()
{
- if (data->references !=1)
+ if (data->ref_count_ !=1)
{
String_data *newdata = new String_data (*data);
down ();