* guile: cosmetic

This commit is contained in:
djcb 2012-07-31 18:46:27 +03:00
parent b4443d1eae
commit 1df0e31062
2 changed files with 19 additions and 23 deletions

View File

@ -302,7 +302,7 @@ typedef struct _AttInfo AttInfo;
static void
each_part (MuMsg *msg, MuMsgPart *part, AttInfo *attinfo)
{
char *mime_type;
char *mime_type, *filename;
SCM elm;
if (!part->type)
@ -312,6 +312,7 @@ each_part (MuMsg *msg, MuMsgPart *part, AttInfo *attinfo)
return;
mime_type = g_strdup_printf ("%s/%s", part->type, part->subtype);
filename = mu_msg_part_get_filename (part, FALSE);
elm = scm_list_5 (
/* msg */
@ -319,19 +320,14 @@ each_part (MuMsg *msg, MuMsgPart *part, AttInfo *attinfo)
/* index */
scm_from_uint(part->index),
/* filename or #f */
part->file_name ?
mu_guile_scm_from_str (part->file_name) :
SCM_BOOL_F,
filename ? mu_guile_scm_from_str (filename) : SCM_BOOL_F,
/* mime-type */
mime_type ?
mu_guile_scm_from_str (mime_type):
SCM_BOOL_F,
mime_type ? mu_guile_scm_from_str (mime_type): SCM_BOOL_F,
/* size */
part->size > 0 ?
scm_from_uint (part->size) :
SCM_BOOL_F);
part->size > 0 ? scm_from_uint (part->size) : SCM_BOOL_F);
g_free (mime_type);
g_free (filename);
attinfo->attlist = scm_cons (elm, attinfo->attlist);
}
@ -356,9 +352,9 @@ SCM_DEFINE (get_parts, "mu:c:get-parts", 1, 1, 0,
attinfo.attachments_only = ATTS_ONLY == SCM_BOOL_T ? TRUE : FALSE;
msgwrap = (MuMsgWrapper*) SCM_CDR(MSG);
mu_msg_part_foreach (msgwrap->_msg,
mu_msg_part_foreach (msgwrap->_msg, MU_MSG_OPTION_NONE,
(MuMsgPartForeachFunc)each_part,
&attinfo, MU_MSG_OPTION_NONE);
&attinfo);
/* explicitly close the file backend, so we won't run of fds */
mu_msg_unload_msg_file (msgwrap->_msg);

View File

@ -88,26 +88,26 @@ mu_guile_init_instance (const char *muhome)
if (!mu_runtime_init (muhome, "guile"))
return FALSE;
err = NULL;
store = mu_store_new_read_only (mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB),
&err);
if (!store) {
mu_guile_g_error (__FUNCTION__, err);
g_clear_error (&err);
return FALSE;
}
if (!store)
goto errexit;
query = mu_query_new (store, &err);
mu_store_unref (store);
if (!query) {
mu_guile_g_error (__FUNCTION__, err);
g_clear_error (&err);
return FALSE;
}
if (!query)
goto errexit;
_singleton = g_new0 (MuGuile, 1);
_singleton->query = query;
return TRUE;
errexit:
mu_guile_g_error (__FUNCTION__, err);
g_clear_error (&err);
return FALSE;
}
static void
@ -161,7 +161,7 @@ SCM_DEFINE_PUBLIC (mu_initialize, "mu:initialize", 0, 1, 0,
else
muhome = scm_to_utf8_string (MUHOME);
rv = mu_guile_init_instance(muhome);
rv = mu_guile_init_instance (muhome);
free (muhome);
if (!rv)