From cdd52ce18d927bddcdfdfa048073b31470f5908c Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Tue, 29 Oct 2019 11:24:08 -0400 Subject: [PATCH] RegularExpression: Initialize RegularExpressionMatch arrays fully The `RegularExpressionMatch` class added by commit cff58f07c (RegularExpression: New RegularExpressionMatch class, 2017-12-04) has members with array-of-pointer types. Use uniform initialization syntax to initialize all array elements on construction. This fixes a Clang scan-build 7 warning: ``` RegularExpression.hxx:138:23: warning: The left operand of '==' is a garbage value if (this->startp[n] == nullptr) { ~~~~~~~~~~~~~~~ ^ ``` --- RegularExpression.hxx.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RegularExpression.hxx.in b/RegularExpression.hxx.in index df7eb45..0c2366b 100644 --- a/RegularExpression.hxx.in +++ b/RegularExpression.hxx.in @@ -70,10 +70,10 @@ private: * \brief Creates an invalid match object */ inline RegularExpressionMatch::RegularExpressionMatch() + : startp{} + , endp{} + , searchstring{} { - startp[0] = nullptr; - endp[0] = nullptr; - searchstring = nullptr; } /** -- GitLab