[cairo] enhanced Cairo::Context#save

Øyvind Kolås islewind at gmail.com
Wed Feb 9 07:28:11 PST 2005


On Wed,  9 Feb 2005 09:54:30 -0500, mental at rydia.net <mental at rydia.net> wrote:
> Quoting Øyvind Kolås <islewind at gmail.com>:
 > Hmm, I though that's what I had done ... is renaming the
> C-implemented method to 'save_internal' a problem?  That's the only
> change made on the C side...

I feel there should be no need to change anything on the c side for
"syntactic sugar"
this is what I commited to CVS:

+    alias save_internal save
+    def save
+        if block_given?
+            save_internal
+            begin
+                yield
+            ensure
+                restore
+            end
+        else
+            save_internal
+        end
+    end

If this were to change in the .c file, I'd prefer doing the yield
there as well. It's a matter of taste though.

/Øyvind K./pippin

-- 
Software patents hinder progress | http://swpat.ffii.org/ 
Web :  http://pippin.gimp.org/



More information about the cairo mailing list