[Mesa-dev] misc: move some member init into constructor initialisation lists

Submitted by Jeremy Newton on Sept. 6, 2016, 3:04 a.m.

Details

Message ID CAHOSEu8n8nOztfjJBGfSdicnn248WZ3JdyiMf2e01FTPEAYAVA@mail.gmail.com
State New
Headers show
Series "misc: move some member init into constructor initialisation lists" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Jeremy Newton Sept. 6, 2016, 3:04 a.m.
This patch moves some member init into the class constructor initialisation
lists.

Rational: somewhat cleaner, better style, and considered to produce better
performance.

Note that I'm not exactly familiar with the patch submission project, or
how to respond to mailing list threads. So, I figured I would start with
something small.

 }

Patch hide | download patch | download mbox

diff --git a/src/amd/addrlib/core/addrobject.cpp
b/src/amd/addrlib/core/addrobject.cpp
index 369be8c..a5edc14 100644
--- a/src/amd/addrlib/core/addrobject.cpp
+++ b/src/amd/addrlib/core/addrobject.cpp
@@ -59,8 +59,8 @@  AddrObject::AddrObject()
 ***************************************************************************************************
 */
 AddrObject::AddrObject(const AddrClient* pClient)
+    : m_client(*pClient)
 {
-    m_client = *pClient;
 }

 /**
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index cb195b2..1101966 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1399,10 +1399,8 @@  ir_swizzle::ir_swizzle(ir_rvalue *val, const
unsigned *comp,
 }

 ir_swizzle::ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask)
-   : ir_rvalue(ir_type_swizzle)
+   : ir_rvalue(ir_type_swizzle), val(val), mask(mask)
 {
-   this->val = val;
-   this->mask = mask;
    this->type = glsl_type::get_instance(val->type->base_type,
  mask.num_components, 1);