Merge branch 'null_arg_handling' into 'main'

Add handling of NULL time_t* pointer as argument

See merge request GNOME/glib!2523
This commit is contained in:
Sebastian Dröge 2022-02-23 07:49:08 +00:00
commit b615afc0fa

View File

@ -294,7 +294,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void void
g_time_val_add (GTimeVal *time_, glong microseconds) g_time_val_add (GTimeVal *time_, glong microseconds)
{ {
g_return_if_fail (time_->tv_usec >= 0 && time_->tv_usec < G_USEC_PER_SEC); g_return_if_fail (time_ != NULL &&
time_->tv_usec >= 0 &&
time_->tv_usec < G_USEC_PER_SEC);
if (microseconds >= 0) if (microseconds >= 0)
{ {
@ -603,7 +605,9 @@ g_time_val_to_iso8601 (GTimeVal *time_)
#endif #endif
time_t secs; time_t secs;
g_return_val_if_fail (time_->tv_usec >= 0 && time_->tv_usec < G_USEC_PER_SEC, NULL); g_return_val_if_fail (time_ != NULL &&
time_->tv_usec >= 0 &&
time_->tv_usec < G_USEC_PER_SEC, NULL);
secs = time_->tv_sec; secs = time_->tv_sec;
#ifdef _WIN32 #ifdef _WIN32