mu: some cosmetics / minor cleanup

This commit is contained in:
djcb
2016-10-25 20:34:08 +03:00
parent 03dd1d653b
commit 7526f118ba
4 changed files with 66 additions and 74 deletions

View File

@ -595,6 +595,7 @@ clear_links (const gchar* dirname, DIR *dir, GError **err)
const char *fp; const char *fp;
char *fullpath; char *fullpath;
unsigned char d_type; unsigned char d_type;
guint len;
/* ignore empty, dot thingies */ /* ignore empty, dot thingies */
if (entry->d_name[0] == '\0' || entry->d_name[0] == '.') if (entry->d_name[0] == '\0' || entry->d_name[0] == '.')
@ -604,8 +605,9 @@ clear_links (const gchar* dirname, DIR *dir, GError **err)
* it returns a static buffer and we are * it returns a static buffer and we are
* recursive*/ * recursive*/
fp = mu_str_fullpath_s (dirname, entry->d_name); fp = mu_str_fullpath_s (dirname, entry->d_name);
fullpath = g_newa (char, strlen(fp) + 1); len = strlen(fp);
strcpy (fullpath, fp); fullpath = g_newa (char, len + 1);
strncpy (fullpath, fp, len);
d_type = GET_DTYPE (entry, fullpath); d_type = GET_DTYPE (entry, fullpath);
@ -767,18 +769,11 @@ mu_maildir_get_maildir_from_path (const char* path)
static char* static char*
get_new_basename (void) get_new_basename (void)
{ {
char hostname[64];
if (gethostname (hostname, sizeof(hostname)) == -1)
memcpy (hostname, "localhost", sizeof(hostname));
else
hostname[sizeof(hostname)-1] = '\0';
return g_strdup_printf ("%u.%08x%08x.%s", return g_strdup_printf ("%u.%08x%08x.%s",
(guint)time(NULL), (guint)time(NULL),
g_random_int(), g_random_int(),
(gint32)g_get_monotonic_time (), (gint32)g_get_monotonic_time (),
hostname); g_get_host_name ());
} }

View File

@ -888,7 +888,7 @@ mu_msg_find_index_for_cid (MuMsg *msg, MuMsgOptions opts,
return get_matching_part_index (msg, opts, return get_matching_part_index (msg, opts,
(MuMsgPartMatchFunc)match_cid, (MuMsgPartMatchFunc)match_cid,
(gpointer)(char*)cid); (gpointer)cid);
} }
struct _RxMatchData { struct _RxMatchData {

View File

@ -437,7 +437,6 @@ mu_util_fputs_encoded (const char *str, FILE *stream)
unsigned bytes; unsigned bytes;
char *conv; char *conv;
g_return_val_if_fail (str, FALSE);
g_return_val_if_fail (stream, FALSE); g_return_val_if_fail (stream, FALSE);
/* g_get_charset return TRUE when the locale is UTF8 */ /* g_get_charset return TRUE when the locale is UTF8 */
@ -557,5 +556,3 @@ mu_util_read_password (const char *prompt)
return g_strdup (pass); return g_strdup (pass);
} }