[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-commit] /srv/bzr/gnash/avm2 r9454: Added function to locate a
From: |
strk |
Subject: |
Re: [Gnash-commit] /srv/bzr/gnash/avm2 r9454: Added function to locate a class by class name. |
Date: |
Wed, 13 Aug 2008 21:32:25 +0200 |
On Wed, Aug 13, 2008 at 12:27:36AM +0800, Tom Stellard wrote:
> +asClass *abc_block::locateClass(std::string className){
Rather then passing strings by-value, take a const ref:
asClass *abc_block::locateClass(const std::string& className)
That way you avoid a string copy (chances are the copy is avoided
anyway if the C++ lib implements copy-on-write, still better be safe).
> + throw GnashException("LocateClass: Class not found.");
Better use a subclass of GnashException, if you really want to use
exceptions here (returning NULL would seem enough).
> abc_block::abc_block() : mStringTable(&VM::get().getStringTable())
> {
> mCH = VM::get().getClassHierarchy();
We're trying to avoid calls to VM::get() when possible.
Each as_object has a reference to the VM, fetchable with
as_object::getVM (dunno if it's possible for you to get an
handle to an as_object).
--strk;