| List: | Commits | « Previous MessageNext Message » | |
| From: | Tor Didriksen | Date: | December 15 2010 11:42am |
| Subject: | Re: bzr commit into mysql-trunk-bugfixing branch (martin.hansson:3260) Bug#58918 | ||
| View as plain text | |||
On Tue, Dec 14, 2010 at 1:50 PM, Martin Hansson <martin.hansson@stripped>wrote: > #At file:///data0/martin/bzrroot/refactoring-Field_clone/n-mr-o-t/ based on > revid:tor.didriksen@stripped > > 3260 Martin Hansson 2010-12-14 > Bug#58918: Add a clone member function to the Field class for better > duplication > > The patch removes all copying of Field objects using memcpy() and > replaces it > with virtual clone() and clone(MEM_ROOT*) member functions that rely > on the > copy constructor. An operator new (MEM_ROOT*) is also implemented. The > sole > purpose of the Field::size_of() member function was to support the > memcpy and > it is now removed. > @ sql/field.cc > Removal of memcpy() based duplication. > @ sql/field.h > New implementation of clone() member functions. > Removal of size_of() member functions > @ sql/item.cc > Removal of memcpy() based duplication. > @@ -84,8 +79,12 @@ class Field > Field(const Item &); /* Prevent use of these */ > void operator=(Field &); > public: > + /* To do: inherit Sql_alloc and get these for free */ > > Why not go all the way :-) This works like a charm: class Field : public Sql_alloc { Field(const Item &); /* Prevent use of these */ void operator=(Field &); public: uchar *ptr; // Position to field in record ... ... -- didrik > -- > MySQL Code Commits Mailing List > For list archives: http://lists.mysql.com/commits > To unsubscribe: > http://lists.mysql.com/commits?unsub=1 >
