[Bugs] [Bug 1780150] New: Reduce variables scope in methods

bugzilla at redhat.com bugzilla at redhat.com
Thu Dec 5 14:00:30 UTC 2019


https://bugzilla.redhat.com/show_bug.cgi?id=1780150

            Bug ID: 1780150
           Summary: Reduce variables scope in methods
           Product: GlusterFS
           Version: mainline
            Status: NEW
         Component: unclassified
          Assignee: bugs at gluster.org
          Reporter: bsasonro at redhat.com
                CC: bugs at gluster.org
  Target Milestone: ---
    Classification: Community



Description of problem:
In many methods, variables have greater scope then required.
An example:

void foobar(...) {
    int res;
    int foo;

    res = ...
    if(!res) {
        foo = ...
    }
}

This can be modified to:
void foobar(...) {
    int res;

    res = ...
    if(!res) {
        int foo;
        foo = ...
    }
}

Actual results:
In the current state, encapsulation is adversely affected by inappropriate
variables scope.

Expected results:
Variables should have "minimum viability" scope in order to enforce
encapsulation.

Additional info:
Modifying this should be an ongoing effort and not focused on solely.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list