Uploaded image for project: 'Libmongocrypt'
  1. Libmongocrypt
  2. MONGOCRYPT-132

Change CLIENT_ERR to a function

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Won't Fix
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • None

    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");
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: