[CDRIVER-2180] Coverity analysis defect 100080: Redundant test Created: 09/Jun/17  Updated: 28/Oct/23  Resolved: 04/Aug/17

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.8.0

Type: Bug Priority: Trivial - P5
Reporter: Coverity Collector User Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Test always evaluates the same

Defect 100080 (STATIC_C)
Checker DEADCODE (subcategory redundant_test)
File: /src/jsonsl/jsonsl.c
Function jsonsl_jpr_new
/src/jsonsl/jsonsl.c, line: 929
Condition "pathret > 0", taking true branch. Now the value of "pathret" is at least 1.
/src/jsonsl/jsonsl.c, line: 927
At condition "pathret > 0", the value of "pathret" must be at least 1.
/src/jsonsl/jsonsl.c, line: 925
Assigning: "pathret" = "JSONSL_PATH_STRING".
/src/jsonsl/jsonsl.c, line: 927
The condition "pathret > 0" must be true.



 Comments   
Comment by Githook User [ 04/Aug/17 ]

Author:

{'username': 'ajdavis', 'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis'}

Message: delete redundant code in jsonsl.c

Merge two upstream fixes:

https://github.com/mnunberg/jsonsl/pull/36
https://github.com/mnunberg/jsonsl/pull/37

CDRIVER-2180 and CDRIVER-2181.
Branch: master
https://github.com/mongodb/libbson/commit/bfcf5b76ebdd1e9c7af7831711121bb96054d9bf

Comment by A. Jesse Jiryu Davis [ 03/Aug/17 ]

This is harmless redundant code in a portion of JSONSL that we don't use. I've submitted a fix upstream:
https://github.com/mnunberg/jsonsl/pull/36

Generated at Wed Feb 07 21:14:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.