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

Jeremy Newton alexjnewt at gmail.com
Tue Sep 6 03:04:20 UTC 2016


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.

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);
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160905/57af6559/attachment.html>


More information about the mesa-dev mailing list