static gint64 get_num_field (MuMsg *self, MuMsgFieldId mfid) { guint64 val; /* first try the cache */ if (mu_msg_cache_cached (self->_cache, mfid)) return mu_msg_cache_num (self->_cache, mfid); /* if it's not in the cache but it is a value retrievable from * the doc backend, use that */ val = -1; if (self->_doc && mu_msg_field_xapian_value (mfid)) val = mu_msg_doc_get_num_field (self->_doc, mfid); else { /* if we don't have a file object yet, we need to * create it from the file on disk */ if (!self->_file) self->_file = get_msg_file (self); if (!self->_file && !(self->_file = get_msg_file (self))) return -1; val = mu_msg_file_get_num_field (self->_file, mfid); } return mu_msg_cache_set_num (self->_cache, mfid, val); }
static gint64 get_num_field (MuMsg *self, MuMsgFieldId mfid) { guint64 val; val = -1; if (self->_doc && mu_msg_field_xapian_value (mfid)) val = mu_msg_doc_get_num_field (self->_doc, mfid); else { /* if we don't have a file object yet, we need to * create it from the file on disk */ if (!mu_msg_load_msg_file (self, NULL)) return -1; val = mu_msg_file_get_num_field (self->_file, mfid); } return val; }