]> git.donarmstrong.com Git - lilypond.git/commitdiff
formatting cleanups, rename
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 25 Aug 2003 10:00:20 +0000 (10:00 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 25 Aug 2003 10:00:20 +0000 (10:00 +0000)
references by ref_count_.

ChangeLog
flower/include/string-data.hh
flower/include/string-data.icc
flower/include/string-handle.hh
flower/include/string-handle.icc

index 6c0d9066df8293ac4213eea5d504bc08001b1713..dbe8f4a54e7949e939cbafeee1962b437bd634fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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
index 3f8ee18104a2e93d1952445c6a5c3984d59d61aa..2404b24e3df59fe08124d8a102e68a5925ee38a7 100644 (file)
@@ -22,7 +22,7 @@ friend class String_handle;
     
     int length_;
     Byte* data_byte_;
-    int references;
+    int ref_count_;
 
     /// init to ""
     String_data ();
index 5a22c41581f8c297d7acf82c4d76e36f33f89688..8ba0a241a80153ad7238c294e5d87dec23ac7834 100644 (file)
@@ -21,7 +21,7 @@ const int INITIALMAX=8;
 INLINE void 
 String_data::OKW () 
 {
-  assert (references == 1);
+  assert (ref_count_ == 1);
 }
 
 INLINE void 
@@ -29,14 +29,14 @@ String_data::OK ()
 {
   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;
@@ -46,7 +46,7 @@ String_data::String_data ()
 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);    
@@ -55,7 +55,7 @@ String_data::String_data (String_data const &src)
 INLINE
 String_data::~String_data () 
 {
-  assert (references == 0);
+  assert (ref_count_ == 0);
   delete[] data_byte_;
 }
 
@@ -65,7 +65,7 @@ String_data::setmax (int j)
   OKW ();
   if (j > maxlen) 
     {
-      delete data_byte_;
+      delete[] data_byte_;
       maxlen = j;
       data_byte_ = new Byte[maxlen + 1];
   
index 12fa77104855a4177745d9e2c6f430fd574001cf..c4619e3b8f17c5ade610d31e22156460e17e9ded 100644 (file)
@@ -30,7 +30,7 @@ class String_handle {
   void up (String_data *d);
     
   /** make sure data has only one reference.      
-      POST: data->references == 1
+      POST: data->ref_count_ == 1
   */
   void copy ();
     
index 827ebf582547977a22171c0e25c0c788cb8c9ed5..66125c12ee9b7a80ffcea4765717352602bf68e6 100644 (file)
 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 ();