[SERVER-9435] mongoutils::str::stripTrailing() is misnamed Created: 23/Apr/13  Updated: 25/Jan/17  Resolved: 12/Jun/15

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.1.5

Type: Improvement Priority: Minor - P4
Reporter: Tad Marshall Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Sharding 5 06/26/16
Participants:

 Description   

The function stripTrailing() in src/mongo/util/mongoutils/str.h does not strip trailing characters from its input string; it strips all occurrences of characters in the 'chars' string from its input string.

The comment /** remove trailing chars in place */ is wrong.

This function is only used in one place that I could find, in some Windows-specific error reporting code in acquirePathLock() in src/mongo/db/instance.cpp.



 Comments   
Comment by Githook User [ 12/Jun/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-9435 Move implementation of str::stripTrailing to site of only caller.

Per SERVER-9435, the function is misleadingly named. It has only one caller, and its
functionality is provided by other standard means, so this patch banishes the implementation
to the near-end-of-life mongoperf.cpp.
Branch: master
https://github.com/mongodb/mongo/commit/b8c1e4d6fce108bc8d3b1721a3bc2fd761aff2e1

Generated at Thu Feb 08 03:20:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.