[ 
https://issues.apache.org/jira/browse/LUCY-145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13033848#comment-13033848
 ] 

Marvin Humphrey commented on LUCY-145:
--------------------------------------

Examples of "good" scope creation can be found in TestCompoundFileWriter.c and
some of the other test files.  Here's an example of "bad" scope creation,
though, taken from PolyReader.c -- the kind of extra that this issue targets.

{noformat}
    {
        Obj *result = PolyReader_Try_Open_SegReaders(self, segments);
        DECREF(segments);
        DECREF(files);
        return result;
    }
}
{noformat}

The solution here would be to remove the lines containing the extra bare 
braces and then to reduce indentation of the text by one level.

> Refactor away C89 excess braces
> -------------------------------
>
>                 Key: LUCY-145
>                 URL: https://issues.apache.org/jira/browse/LUCY-145
>             Project: Lucy
>          Issue Type: Sub-task
>            Reporter: Marvin Humphrey
>            Priority: Trivial
>
> Because C89 does not allow mixed declarations and code, we have occasionally
> used bare braces to create new scopes solely for the purpose of declaring a
> variable or two.  In some cases, this was appropriate to limit the scope of a
> short lived variable in the midst of a long function, but there were other
> cases when we were just declaring a return value or such towards the end and
> C89 forced the issue.
> To find candidates for review, use the following command:
> {noformat}
>     grep -r "^ \+{ *$" lucy/ | grep -v -e "svn\|charmonizer\|modules\|\.pm"
> {noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to