[PATCH 1/6] lib/cli: Make notmuch_database_open return a status code

Austin Clements amdragon at MIT.EDU
Mon Apr 30 09:15:55 PDT 2012


Quoth David Bremner on Apr 30 at  8:39 am:
> 
> I have two questions, both of which might have been settled previously.
> 
> >  
> > -    return notmuch;
> > +    *database = notmuch;
> > +    return status;
> >  }
> 
> Should we check database is non-NULL here?

Sure, why not.  Since one could now imagine using these functions to
create a database without using it or test if a database exists, I
made them handle a NULL pointer gracefully.

> > diff --git a/notmuch-count.c b/notmuch-count.c
> > index 9c2ad7b..2f98128 100644
> > --- a/notmuch-count.c
> > +++ b/notmuch-count.c
> 
> > +    if (notmuch_database_open (notmuch_config_get_database_path (config),
> > +			       NOTMUCH_DATABASE_MODE_READ_ONLY, &notmuch))
> 
> Is it OK to rely on NOTMUCH_STATUS_SUCCESS==0 ?

I decree it so.  Plus, we already do this sort of thing all over the
place.


More information about the notmuch mailing list