[fossology/fossology] cadc43: refactor(wget_agent): Consolidate global variables


Andreas Reichel <noreply@...>
 

Branch: refs/heads/andreas/test
Home: https://github.com/fossology/fossology
Commit: cadc43dc12f1c8eefe7a5d0eaa81d7dfac636089
https://github.com/fossology/fossology/commit/cadc43dc12f1c8eefe7a5d0eaa81d7dfac636089
Author: Andreas J. Reichel <andreas.reichel@...>
Date: 2019-08-14 (Wed, 14 Aug 2019)

Changed paths:
M src/wget_agent/agent/main.c
M src/wget_agent/agent/wget_agent.c
M src/wget_agent/agent/wget_agent.h

Log Message:
-----------
refactor(wget_agent): Consolidate global variables

Dont use a GlobalXYZ name scheme, but put global variables into a
struct g to encapsulate them, like g.XYZ.

Also don't initialize them all over the place and redundantly, but
do it inside a function.

Furthermore, global variables are auto initialized to 0 by libc.
There is no need to do that manually.

Signed-off-by: Andreas J. Reichel <andreas.reichel@...>


Commit: bac93ba0ed5b6a28842e4acbc495d61963fd2453
https://github.com/fossology/fossology/commit/bac93ba0ed5b6a28842e4acbc495d61963fd2453
Author: Andreas J. Reichel <andreas.reichel@...>
Date: 2019-08-14 (Wed, 14 Aug 2019)

Changed paths:
M src/wget_agent/agent/main.c
M src/wget_agent/agent/wget_agent.c

Log Message:
-----------
refactor(wget_agent): Make it more readable

Improve code formating a little for further changes

Signed-off-by: Andreas J. Reichel <andreas.reichel@...>


Commit: d6052b0e8b6ef1c252fc2f60a2327987d8a8e445
https://github.com/fossology/fossology/commit/d6052b0e8b6ef1c252fc2f60a2327987d8a8e445
Author: Andreas J. Reichel <andreas.reichel@...>
Date: 2019-08-14 (Wed, 14 Aug 2019)

Changed paths:
M src/wget_agent/agent/wget_agent.c
M src/wget_agent/agent/wget_agent.h

Log Message:
-----------
fix(wget_agent): Use asprintf instead of sprintf/snprintf

asprintf allocates as much memory as is needed, so no buffer
size guessing is necessary and no buffer overflow occurs.

This function requires GNU_SOURCE, which is no problem with the
project's LICENSE file.

Signed-off-by: Andreas J. Reichel <andreas.reichel@...>


Commit: e17b59c27bc719c1df633b8e6dc4e6b143f4f1b3
https://github.com/fossology/fossology/commit/e17b59c27bc719c1df633b8e6dc4e6b143f4f1b3
Author: Andreas J. Reichel <andreas.reichel@...>
Date: 2019-08-14 (Wed, 14 Aug 2019)

Changed paths:
M src/wget_agent/agent_tests/Unit/wget_agent/testDBLoadGold.c
M src/wget_agent/agent_tests/Unit/wget_agent/testGetURL.c
M src/wget_agent/agent_tests/Unit/wget_agent/testSetEnv.c

Log Message:
-----------
fix(wget_agent/agent_tests): Fix unit tests to compile

Signed-off-by: Andreas J. Reichel <andreas.reichel@...>


Commit: 976ec3180fc331136ce0b1351f1318e3d8a622be
https://github.com/fossology/fossology/commit/976ec3180fc331136ce0b1351f1318e3d8a622be
Author: Andreas J. Reichel <andreas.reichel@...>
Date: 2019-08-27 (Tue, 27 Aug 2019)

Changed paths:
M src/wget_agent/agent/wget_agent.c

Log Message:
-----------
[WIP] Debug Unit test


Compare: https://github.com/fossology/fossology/compare/cadc43dc12f1%5E...976ec3180fc3

Join fossology-commits@lists.fossology.org to automatically receive all group messages.