mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-01-03 07:11:41 +01:00
date.c: Remove all occurrences of g_return_val_if_fail
That's got to be one of the hardest macro names to read, ever, (it's phrased with an implicit negative in the condition, rather than something simple like "assert"). Plus, it's evil, since it's a macro with a return in it. And finally, it's actually *longer* than just typing "if" and "return". So what's the point of this ugly idiom?
This commit is contained in:
parent
9f3649370c
commit
dbadca9a63
1 changed files with 11 additions and 6 deletions
17
date.c
17
date.c
|
@ -222,8 +222,9 @@ static int
|
||||||
get_wday (const char *in, size_t inlen)
|
get_wday (const char *in, size_t inlen)
|
||||||
{
|
{
|
||||||
int wday;
|
int wday;
|
||||||
|
|
||||||
g_return_val_if_fail (in != NULL, -1);
|
if (in == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (inlen < 3)
|
if (inlen < 3)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -241,7 +242,8 @@ get_mday (const char *in, size_t inlen)
|
||||||
{
|
{
|
||||||
int mday;
|
int mday;
|
||||||
|
|
||||||
g_return_val_if_fail (in != NULL, -1);
|
if (in == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
mday = decode_int (in, inlen);
|
mday = decode_int (in, inlen);
|
||||||
|
|
||||||
|
@ -256,7 +258,8 @@ get_month (const char *in, size_t inlen)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g_return_val_if_fail (in != NULL, -1);
|
if (in == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (inlen < 3)
|
if (inlen < 3)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -274,7 +277,8 @@ get_year (const char *in, size_t inlen)
|
||||||
{
|
{
|
||||||
int year;
|
int year;
|
||||||
|
|
||||||
g_return_val_if_fail (in != NULL, -1);
|
if (in == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if ((year = decode_int (in, inlen)) == -1)
|
if ((year = decode_int (in, inlen)) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -405,7 +409,8 @@ parse_rfc822_date (date_token *tokens, int *tzone)
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
g_return_val_if_fail (tokens != NULL, (time_t) 0);
|
if (tokens == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
token = tokens;
|
token = tokens;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue