After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749190 - Minor fixes for dead code and redundant variable checks
Minor fixes for dead code and redundant variable checks
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2015-05-10 10:20 UTC by Philip Withnall
Modified: 2015-05-11 23:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
edataserver: Fix error reporting in ESource credentials method (1.54 KB, patch)
2015-05-10 10:20 UTC, Philip Withnall
committed Details | Review
calendar: Remove dead code in HTTP backend (1.23 KB, patch)
2015-05-10 10:20 UTC, Philip Withnall
committed Details | Review
edataserver: Remove unused code from EFreeFormExp (1.21 KB, patch)
2015-05-10 10:20 UTC, Philip Withnall
reviewed Details | Review
edataserverui: Remove redundant check for an error being set (1.39 KB, patch)
2015-05-10 10:21 UTC, Philip Withnall
committed Details | Review
edataserver: Remove redundant code path from e_source_dup_secret_label() (1.31 KB, patch)
2015-05-10 10:21 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2015-05-10 10:20:46 UTC
All spotted by Coverity in its latest run. Some of these fixes will produce user-visible changes to error reporting (where previously that error reporting was broken). Some of them simply remove dead code — these need review by someone who knows what the original intention of that code was, since I am not sure whether the dead code was meant to be used and is instead being masked by a bug elsewhere which is not setting up the right conditions for the dead code to be used.

If you need access to Coverity to see its control flow analysis, please let me know!
Comment 1 Philip Withnall 2015-05-10 10:20:50 UTC
Created attachment 303172 [details] [review]
edataserver: Fix error reporting in ESource credentials method

In e_source_unset_last_credentials_required_arguments_sync(); similarly
in e_source_get_last_credentials_required_arguments_sync(). Spotted by
Coverity.

CID: #1297157, #1296550
Comment 2 Philip Withnall 2015-05-10 10:20:54 UTC
Created attachment 303173 [details] [review]
calendar: Remove dead code in HTTP backend

The HTTP status cannot be SOUP_STATUS_SSL_FAILED inside the
SOUP_STATUS_IS_REDIRECTION block. Spotted by Coverity.

CID: #1296551
Comment 3 Philip Withnall 2015-05-10 10:20:59 UTC
Created attachment 303174 [details] [review]
edataserver: Remove unused code from EFreeFormExp

At that point in the control flow, word is always NULL, hence checking
it is a no-op. This might actually be a bug further up in the code — I
do not know enough about this function to be sure. Spotted by Coverity.

CID: #1296549
Comment 4 Philip Withnall 2015-05-10 10:21:03 UTC
Created attachment 303175 [details] [review]
edataserverui: Remove redundant check for an error being set

There is no way this loop can have local_error set before checking
whether it is NULL. Even if the declaration of local_error was hoisted
to the parent scope, all control paths which lead to the loop being
entered would have local_error set to NULL. This might not be the
correct fix, but there is certainly a problem somewhere in this code.
Spotted by Coverity.

CID: #1296548
Comment 5 Philip Withnall 2015-05-10 10:21:07 UTC
Created attachment 303176 [details] [review]
edataserver: Remove redundant code path from e_source_dup_secret_label()

Further up in the code, backend_name is cleared if (type == NULL),
leaving the possible options as:
 1. (backend_name != NULL && type != NULL)
 2. (backend_name == NULL && type != NULL)
 3. (backend_name == NULL && type == NULL)

Spotted by Coverity.

CID: #1296547
Comment 6 Milan Crha 2015-05-11 16:46:20 UTC
Review of attachment 303172 [details] [review]:

Right, I just made this same fix for 3.17.2+ (commit 2a755c34ea) and 3.16.3+ (commit 4571a71ab4).
Comment 7 Milan Crha 2015-05-11 16:47:17 UTC
Review of attachment 303173 [details] [review]:

Looks fine, feel free to commit.
Comment 8 Milan Crha 2015-05-11 16:49:39 UTC
Review of attachment 303174 [details] [review]:

Let's cleanup the code a bit. (I'll do it.)
Comment 9 Milan Crha 2015-05-11 16:58:14 UTC
(In reply to Milan Crha from comment #8)
> Let's cleanup the code a bit. (I'll do it.)

Created commit 756ccc0 in eds master (3.17.2+)
Created commit 581b100 in eds gnome-3-16 (3.16.3+)
Comment 10 Milan Crha 2015-05-11 17:01:32 UTC
Review of attachment 303175 [details] [review]:

Looks fine, feel free to commit.
Comment 11 Milan Crha 2015-05-11 17:04:24 UTC
Review of attachment 303176 [details] [review]:

Looks fine, feel free to commit.
Comment 12 Philip Withnall 2015-05-11 23:08:34 UTC
Thanks for the fast reviews and fixes. All pushed to master.

Attachment 303173 [details] pushed as fdd7ef0 - calendar: Remove dead code in HTTP backend
Attachment 303175 [details] pushed as 6ec4694 - edataserverui: Remove redundant check for an error being set
Attachment 303176 [details] pushed as 7014b0f - edataserver: Remove redundant code path from e_source_dup_secret_label()