[Webkit-unassigned] [Bug 88805] New: unneeded object creation with Vector::append

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 11 14:02:35 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=88805

           Summary: unneeded object creation with Vector::append
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebKit Gtk
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: arno at renevier.net


Hi,
in contextMenuItemVector,

menuItemVector.append(ContextMenuItem(GTK_MENU_ITEM(widget)));

creates a ContextMenuItem, and pass it to Vector::append(const U& val)
which then creates a new object with 
new T(val)
which just copies the ContextMenuItem object

so, it's possible to just pass GTK_MENU_ITEM(widget), and only one ContextMenuItem object will be created.

The same pattern is also present in KeyBindingTranslator::addPendingEditorCommand

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list