mongoc_cursor_t *
_mongoc_cursor_cursorid_clone (const mongoc_cursor_t *cursor)
{
   mongoc_cursor_t *clone;

   ENTRY;

   clone = _mongoc_cursor_clone (cursor);
   _mongoc_cursor_cursorid_init (clone);

   RETURN (clone);
}
static mongoc_cursor_t *
_mongoc_cursor_cursorid_clone (const mongoc_cursor_t *cursor)
{
   mongoc_cursor_t *clone_;

   ENTRY;

   clone_ = _mongoc_cursor_clone (cursor);
   _mongoc_cursor_cursorid_init (clone_, &cursor->filter);

   RETURN (clone_);
}
static mongoc_cursor_t *
_mongoc_cursor_array_clone (const mongoc_cursor_t *cursor)
{
   mongoc_cursor_array_t *arr;
   mongoc_cursor_t *clone_;

   ENTRY;

   arr = (mongoc_cursor_array_t *)cursor->iface_data;

   clone_ = _mongoc_cursor_clone (cursor);
   _mongoc_cursor_array_init (clone_, arr->field_name);

   RETURN (clone_);
}
mongoc_cursor_t *
mongoc_cursor_clone (const mongoc_cursor_t *cursor)
{
   mongoc_cursor_t *ret;

   BSON_ASSERT(cursor);

   if (cursor->interface.clone) {
      ret = cursor->interface.clone(cursor);
   } else {
      ret = _mongoc_cursor_clone(cursor);
   }

   RETURN(ret);
}
static mongoc_cursor_t *
_mongoc_cursor_transform_clone (const mongoc_cursor_t *cursor)
{
   mongoc_cursor_transform_t *transform;
   mongoc_cursor_t *clone_;

   ENTRY;

   transform = cursor->iface_data;

   clone_ = _mongoc_cursor_clone (cursor);
   _mongoc_cursor_transform_init (clone_, transform->filter, transform->mutate,
                                  transform->dtor, transform->ctx);

   RETURN (clone_);
}