GenericList.h and GenericList.c
##GenericList.h and GenericList.c GenerallyGenerally this is excellent code as long as it is a stack you want. It seems that what is created is really a generic stack implemented on a linked list rather than a generic linked list. If it was truly a generic linked list there would also be an append function and the delete node function would have to be smart enough to reset the next pointer of the previous node to the node being deleted next node.
Good things are that GenericList.h
has include guards, malloc()
is used properly and the return value is tested, I don't see any memory leaks.
A possible issue with GenericList.h
is that all the includes that are required by GenericList.c
are included in GenericList.h
and those include files are not needed by Test.c
.
GenericList.c
is well designed and implemented, all the functions are well designed and implemented.
Test.c
##Test.c
II realize that this is just a test file, but the same care that was given to GenericList.h
and GenericList.c
should be given to the test code as well.
The main()
function is too complex (does too much) and should be broken up into multiple functions (each loop should probably be a function). As it stands it would be very difficult to expand the functionality of the test code if additional functionality was added to GenericList.h
and GenericList.c
.
Rather than return 0
or 1
for the program status, it would be better to include <stdlib.h>
in main and utilize the EXIT_SUCCESS
and EXIT_FAILURE
symbolic constants.
One other issue I see in Test.c
is that it can use some blank lines for vertical spacing between the tests, this wouldn't be necessary if the tests were functions.
##GenericList.h and GenericList.c Generally this is excellent code as long as it is a stack you want. It seems that what is created is really a generic stack implemented on a linked list rather than a generic linked list. If it was truly a generic linked list there would also be an append function and the delete node function would have to be smart enough to reset the next pointer of the previous node to the node being deleted next node.
Good things are that GenericList.h
has include guards, malloc()
is used properly and the return value is tested, I don't see any memory leaks.
A possible issue with GenericList.h
is that all the includes that are required by GenericList.c
are included in GenericList.h
and those include files are not needed by Test.c
.
GenericList.c
is well designed and implemented, all the functions are well designed and implemented.
##Test.c
I realize that this is just a test file, but the same care that was given to GenericList.h
and GenericList.c
should be given to the test code as well.
The main()
function is too complex (does too much) and should be broken up into multiple functions (each loop should probably be a function). As it stands it would be very difficult to expand the functionality of the test code if additional functionality was added to GenericList.h
and GenericList.c
.
Rather than return 0
or 1
for the program status, it would be better to include <stdlib.h>
in main and utilize the EXIT_SUCCESS
and EXIT_FAILURE
symbolic constants.
One other issue I see in Test.c
is that it can use some blank lines for vertical spacing between the tests, this wouldn't be necessary if the tests were functions.
GenericList.h and GenericList.c
Generally this is excellent code as long as it is a stack you want. It seems that what is created is really a generic stack implemented on a linked list rather than a generic linked list. If it was truly a generic linked list there would also be an append function and the delete node function would have to be smart enough to reset the next pointer of the previous node to the node being deleted next node.
Good things are that GenericList.h
has include guards, malloc()
is used properly and the return value is tested, I don't see any memory leaks.
A possible issue with GenericList.h
is that all the includes that are required by GenericList.c
are included in GenericList.h
and those include files are not needed by Test.c
.
GenericList.c
is well designed and implemented, all the functions are well designed and implemented.
Test.c
I realize that this is just a test file, but the same care that was given to GenericList.h
and GenericList.c
should be given to the test code as well.
The main()
function is too complex (does too much) and should be broken up into multiple functions (each loop should probably be a function). As it stands it would be very difficult to expand the functionality of the test code if additional functionality was added to GenericList.h
and GenericList.c
.
Rather than return 0
or 1
for the program status, it would be better to include <stdlib.h>
in main and utilize the EXIT_SUCCESS
and EXIT_FAILURE
symbolic constants.
One other issue I see in Test.c
is that it can use some blank lines for vertical spacing between the tests, this wouldn't be necessary if the tests were functions.
##GenericList.h and GenericList.c Generally this is excellent code as long as it is a stack you want. It seems that what is created is really a generic stack implemented on a linked list rather than a generic linked list. If it was truelytruly a generic linked list there would also be an append function and the delete node function would have to be smart enough to reset the next pointer of the previous node to the node being deleted next node.
Good things are that GenericList.h
has include guards, malloc()
is used properly and the return value is tested, I don't see any memory leaks.
A possible issue with GenericList.h
is that all the includes that are required by ``GenericList.care included inGenericList.c
GenericList.h are included in and those include files are not needed byGenericList.h
Test.c` and those include files are not needed by Test.c
.
GenericList.c
is well designed and implemented, all the functions are well designed and implemented.
##Test.c
I realize that this is just a test file, but the same care that was given to GenericList.hGenericList.h
and GenericList.cGenericList.c
should be given to the test code as well.
The main()
function is too complex (does too much) and should be broken up into multiple functions (each loop should probably be a function). As it stands it would be very difficult to expand the functionality of the test code if additional functionality was added to GenericList.hGenericList.h
and GenericList.cGenericList.c
.
Rather than return 00
or 11
for the program status, it would be better to include <stdlib.h>
in main and utilize the EXIT_SUCCESS
and EXIT_FAILURE
symbolic constants.
One other issue I see in Test.cTest.c
is that it can use some blank lines for vertical spacing between the tests, this wouldn't be necessary if the tests were functions.
##GenericList.h and GenericList.c Generally this is excellent code as long as it is a stack you want. It seems that what is created is really a generic stack implemented on a linked list rather than a generic linked list. If it was truely a generic linked list there would also be an append function and the delete node function would have to be smart enough to reset the next pointer of the previous node to the node being deleted next node.
Good things are that GenericList.h
has include guards, malloc()
is used properly and the return value is tested, I don't see any memory leaks.
A possible issue with GenericList.h
is that all the includes that are required by ``GenericList.care included in
GenericList.hand those include files are not needed by
Test.c`.
GenericList.c
is well designed and implemented, all the functions are well designed and implemented.
##Test.c I realize that this is just a test file, but the same care that was given to GenericList.h and GenericList.c should be given to the test code as well.
The main()
function is too complex (does too much) and should be broken up into multiple functions (each loop should probably be a function). As it stands it would be very difficult to expand the functionality of the test code if additional functionality was added to GenericList.h and GenericList.c.
Rather than return 0 or 1 for the program status, it would be better to include <stdlib.h>
in main and utilize the EXIT_SUCCESS
and EXIT_FAILURE
symbolic constants.
One other issue I see in Test.c is that it can use some blank lines for vertical spacing between the tests, this wouldn't be necessary if the tests were functions.
##GenericList.h and GenericList.c Generally this is excellent code as long as it is a stack you want. It seems that what is created is really a generic stack implemented on a linked list rather than a generic linked list. If it was truly a generic linked list there would also be an append function and the delete node function would have to be smart enough to reset the next pointer of the previous node to the node being deleted next node.
Good things are that GenericList.h
has include guards, malloc()
is used properly and the return value is tested, I don't see any memory leaks.
A possible issue with GenericList.h
is that all the includes that are required by GenericList.c
are included in GenericList.h
and those include files are not needed by Test.c
.
GenericList.c
is well designed and implemented, all the functions are well designed and implemented.
##Test.c
I realize that this is just a test file, but the same care that was given to GenericList.h
and GenericList.c
should be given to the test code as well.
The main()
function is too complex (does too much) and should be broken up into multiple functions (each loop should probably be a function). As it stands it would be very difficult to expand the functionality of the test code if additional functionality was added to GenericList.h
and GenericList.c
.
Rather than return 0
or 1
for the program status, it would be better to include <stdlib.h>
in main and utilize the EXIT_SUCCESS
and EXIT_FAILURE
symbolic constants.
One other issue I see in Test.c
is that it can use some blank lines for vertical spacing between the tests, this wouldn't be necessary if the tests were functions.
##GenericList.h and GenericList.c Generally this is excellent code as long as it is a stack you want. It seems that what is created is really a generic stack implemented on a linked list rather than a generic linked list. If it was truely a generic linked list there would also be an append function and the delete node function would have to be smart enough to reset the next pointer of the previous node to the node being deleted next node.
Good things are that GenericList.h
has include guards, malloc()
is used properly and the return value is tested, I don't see any memory leaks.
A possible issue with GenericList.h
is that all the includes that are required by ``GenericList.care included in
GenericList.hand those include files are not needed by
Test.c`.
GenericList.c
is well designed and implemented, all the functions are well designed and implemented.
##Test.c I realize that this is just a test file, but the same care that was given to GenericList.h and GenericList.c should be given to the test code as well.
The main()
function is too complex (does too much) and should be broken up into multiple functions (each loop should probably be a function). As it stands it would be very difficult to expand the functionality of the test code if additional functionality was added to GenericList.h and GenericList.c.
Rather than return 0 or 1 for the program status, it would be better to include <stdlib.h>
in main and utilize the EXIT_SUCCESS
and EXIT_FAILURE
symbolic constants.
One other issue I see in Test.c is that it can use some blank lines for vertical spacing between the tests, this wouldn't be necessary if the tests were functions.