* small cleanups (macos)
This commit is contained in:
@ -225,7 +225,7 @@ mu_date_str_to_time_t (const char* date, gboolean local)
|
|||||||
struct tm tm;
|
struct tm tm;
|
||||||
char mydate[14 + 1]; /* YYYYMMDDHHMMSS */
|
char mydate[14 + 1]; /* YYYYMMDDHHMMSS */
|
||||||
time_t t;
|
time_t t;
|
||||||
const char *tz;
|
char *tz;
|
||||||
|
|
||||||
memset (&tm, 0, sizeof(struct tm));
|
memset (&tm, 0, sizeof(struct tm));
|
||||||
strncpy (mydate, date, 15);
|
strncpy (mydate, date, 15);
|
||||||
@ -239,13 +239,15 @@ mu_date_str_to_time_t (const char* date, gboolean local)
|
|||||||
tm.tm_mday = atoi (mydate + 6); mydate[6] = '\0';
|
tm.tm_mday = atoi (mydate + 6); mydate[6] = '\0';
|
||||||
tm.tm_mon = atoi (mydate + 4) - 1; mydate[4] = '\0';
|
tm.tm_mon = atoi (mydate + 4) - 1; mydate[4] = '\0';
|
||||||
tm.tm_year = atoi (mydate) - 1900;
|
tm.tm_year = atoi (mydate) - 1900;
|
||||||
tm.tm_isdst = -1; /* figure out the dst */
|
tm.tm_isdst = -1; /* let mktime figure out the dst */
|
||||||
|
|
||||||
if (!local) { /* temporarily switch to UTC */
|
if (!local) { /* temporarily switch to UTC */
|
||||||
tz = getenv ("TZ");
|
tz = getenv ("TZ");
|
||||||
|
tz = tz ? g_strdup (tz) : NULL;
|
||||||
setenv ("TZ", "", 1);
|
setenv ("TZ", "", 1);
|
||||||
tzset ();
|
tzset ();
|
||||||
}
|
} else
|
||||||
|
tz = NULL;
|
||||||
|
|
||||||
t = mktime (&tm);
|
t = mktime (&tm);
|
||||||
|
|
||||||
@ -257,6 +259,8 @@ mu_date_str_to_time_t (const char* date, gboolean local)
|
|||||||
tzset ();
|
tzset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (tz);
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -70,10 +70,14 @@ do_wordexp (const char *path)
|
|||||||
/* strangely, below seems to lead to a crash on MacOS (BSD);
|
/* strangely, below seems to lead to a crash on MacOS (BSD);
|
||||||
so we have to allow for a tiny leak here on that
|
so we have to allow for a tiny leak here on that
|
||||||
platform... maybe instead of __APPLE__ it should be
|
platform... maybe instead of __APPLE__ it should be
|
||||||
__BSD__?*/
|
__BSD__?
|
||||||
#ifndef __APPLE__
|
|
||||||
|
Hmmm., cannot reproduce that crash anymore, so commenting
|
||||||
|
it out for now...
|
||||||
|
*/
|
||||||
|
/* #ifndef __APPLE__ */
|
||||||
wordfree (&wexp);
|
wordfree (&wexp);
|
||||||
#endif /*__APPLE__*/
|
/* #endif /\*__APPLE__*\/ */
|
||||||
return dir;
|
return dir;
|
||||||
|
|
||||||
# else /*!HAVE_WORDEXP_H*/
|
# else /*!HAVE_WORDEXP_H*/
|
||||||
|
|||||||
Reference in New Issue
Block a user