Hi Rahila,
On Thu, May 11, 2017 at 7:37 PM, Rahila Syed <[email protected]> wrote:
>
> >3.
> >In following function isDefaultPartitionBound, first statement "return
> false"
> >is not needed.
> It is needed to return false if the node is not DefElem.
>
Please have a look at following code:
+ * Returns true if the partition bound is default
+ */
+bool
+isDefaultPartitionBound(Node *value)
+{
+ if (IsA(value, DefElem))
+ {
+ DefElem defvalue = (DefElem ) value;
+ if(!strcmp(defvalue->defname, "DEFAULT"))
+ return true;
+ return false;
+ }
+ return false;
+}
By first return false, I mean to say the return statement inside the
if block "if (IsA(value, DefElem))":
+ if(!strcmp(defvalue->defname, "DEFAULT"))
+ return true;
+ return false;
Even if this "return false" is not present, the control is anyway going to
fall through and will return false from the outermost return statement.
I leave this decision to you, but further this block could be rewritten as
below and also can be defined as a macro:
bool
isDefaultPartitionBound(Node *value)
{
return (IsA(value, DefElem) &&
!strcmp(((DefElem) value)->defname, "DEFAULT"));
}
Regards,
Jeevan Ladhe