[MONGOCRYPT-132] Change CLIENT_ERR to a function Created: 04/Jun/19  Updated: 13/Feb/20  Resolved: 15/Oct/19

Status: Closed
Project: Libmongocrypt
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: Kevin Albertson Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

CLIENT_ERR implicitly depends on a status variable being defined. It results in code like this:

mongocrypt_status_t *status;
status = crypt->status;
CLIENT_ERR ("cannot create context from uninitialized crypt");
return false;

Though CLIENT_ERR does support printf arguments, almost none of the cases use them. I think it'd be preferable to define a function like:

/* always returns false. */
bool _mongocrypt_status_fail (mongocrypt_status_t* status, const char*  msg);

So code like the case above can be refactored into:

return _mongocrypt_status_fail (status, "cannot create context from uninitialized crypt");


Generated at Thu Feb 08 09:08:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.