Skip to content

[orchagent]: Remove the global variable gPortsOrch in orch.cpp file#366

Merged
stcheng merged 1 commit intosonic-net:masterfrom
stcheng:portsorch
Nov 2, 2017
Merged

[orchagent]: Remove the global variable gPortsOrch in orch.cpp file#366
stcheng merged 1 commit intosonic-net:masterfrom
stcheng:portsorch

Conversation

@stcheng
Copy link
Contributor

@stcheng stcheng commented Nov 1, 2017

This change is the first step of refactoring Orch class.
The global variable gPortsOrch is removed from that orch.cpp file
and this class no longer requires such external variable.

The current solution is to move the global variable into each different
places that need this variable. Later, a better design could be
introduced to further remove all the global variables from the whole
project.

Signed-off-by: Shu0T1an ChenG [email protected]

What I did
Remove the gPortsOrch from the orch.cpp file.

Why I did it
Free the orch.cpp file.

How I verified it
Compile and run the code.

This change is the first step of refactoring Orch class.
The global variable gPortsOrch is removed from that orch.cpp file
and this class no longer requires such external variable.

The current solution is to move the global variable into each different
places that need this variable. Later, a better design could be
introduced to further remove all the global variables from the whole
project.

Signed-off-by: Shu0T1an ChenG <[email protected]>
@stcheng stcheng requested a review from lguohan November 1, 2017 22:19
@stcheng
Copy link
Contributor Author

stcheng commented Nov 1, 2017

@JipanYanga could you check this pull request? thanks.

@jipanyang
Copy link
Contributor

@stcheng As the first step of eliminating global variables from Orch class, the change looks good to me.
We should come up the new design asap. With "gPortsOrch->isInitDone()" check in more places,
it is a little like the spread of germs.

@stcheng stcheng merged commit 136621b into sonic-net:master Nov 2, 2017
@stcheng stcheng deleted the portsorch branch November 2, 2017 07:09
@andriymoroz-mlnx
Copy link
Contributor

If global variable gPortsOrch is removed from orch.cpp, why
extern PortsOrch *gPortsOrch;
is still there? ;)

@stcheng
Copy link
Contributor Author

stcheng commented Nov 2, 2017

@andriymoroz-mlnx ah thanks, i'll remove it.

EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-swss that referenced this pull request Mar 1, 2023
* Add VS support for setting stats via redis DB channel

* Remove SET description
Janetxxx pushed a commit to Janetxxx/sonic-swss that referenced this pull request Nov 10, 2025
…onic-net#366)

This change is the first step of refactoring Orch class.
The global variable gPortsOrch is removed from that orch.cpp file
and this class no longer requires such external variable.

The current solution is to move the global variable into each different
places that need this variable. Later, a better design could be
introduced to further remove all the global variables from the whole
project.

Signed-off-by: Shu0T1an ChenG <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants