Commit graph

13 commits

Author SHA1 Message Date
Carl Worth
eb7b8cf31a Add -Wwrite-strings and fix warnings.
Need to be const-clean when handling string literals.
2009-10-25 15:55:23 -07:00
Carl Worth
fa562fa22b Hook up our fancy new notmuch_parse_date function.
With all the de-glib-ification out of the way, we can now use it
to allow for date-based sorting of Xapian search results.
2009-10-19 13:35:29 -07:00
Carl Worth
401c6cc579 notmuch_parse_date: Handle a NULL date string gracefully.
The obvious thing to do is to treat a missing date as the beginning
of time. Also, remove a useless cast from another return of 0.
2009-10-19 13:24:12 -07:00
Carl Worth
8e4e0559e7 date.c: Rename function to notmuch_parse_date
Now completing the process of making this function "our own".

The documentation is deleted here, because we already have
the documentation we want in notmuch-private.h.
2009-10-19 13:24:07 -07:00
Carl Worth
747f610901 date.c: Add hard-coded definition of HAVE_TIMEZONE
The original code expected this to be set by running configure.
We'll just manually set it here for now. This isn't as portable
as if we were doing some compile-time examination of the current
system, but I don't need portability now.

When someone comes along that wants to port notmuch to another
system, they will already have all the #ifdefs in place and
will simply need to add the appropriate machinery to set the
defines.
2009-10-19 13:19:37 -07:00
Carl Worth
c2c50d50c5 date.c: Don't use glib's slice allocator.
This change is gratuitous. For now, notmuch is still linking
against glib, so I don't have any requirement to remove this,
(unlike the last few changes where good taste really did
require the changes).

The motivation here is two-fold:

1. I'm considering switching away from all glib-based allocation
soon so that I can more easily verify that the memory management
is solid. I want valgrind to say "no leaks are possible" not
"there is tons of memory still allocated, but probably reachable
so who knows if there are leaks or not?". And glib seems to make
that impossible.

2. I don't think there's anything performance-sensitive about the
allocation here. (In fact, if there is, then the right answer
would be to do this parsing without any allocation whatsoever.)
2009-10-19 13:14:37 -07:00
Carl Worth
c777524834 date.c: Remove occurrences of gboolean.
While this is surely one of the most innocent typedefs, it still
annoys me to have basic types like 'int' re-defined like this.
It just makes it harder to copy the code between projects, with
very little benefit in readability.

For readability, predicate functions and variables should be
obviously Boolean-natured by their actual *names*.
2009-10-19 13:11:57 -07:00
Carl Worth
dbadca9a63 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?
2009-10-19 13:09:19 -07:00
Carl Worth
9f3649370c date.c: Keep the comments clean.
Never know when the children might be reading over my shoulder,
for example. :-)
2009-10-19 13:07:58 -07:00
Carl Worth
f638fbf8d6 date.c: Change headers/defines t owork within notmuch.
We can't rely on any gmime-internal headers, (and fortunately we
don't need to). We also aren't burdened with any autconf machinery
so don't reference any of that.
2009-10-19 13:06:55 -07:00
Carl Worth
e26a2bf48b date.c: Remove a bunch of undesired code.
We're only interested in the date-parsing code here.
2009-10-19 13:06:37 -07:00
Carl Worth
4f9aa77d80 date.c: Convert from LGPL-2+ to GPL-3+
As authorized by LGPL-2 term (3).
2009-10-19 13:02:17 -07:00
Carl Worth
f5f8dcf2a0 date.c: Add new file directly from gmime2.4-2.4.6/gmime/gmime-utils.c
We're sucking in one gmime implementation file just to get the
piece that parses an RFC 822 date, because I don't want to go
through the pain of replicating that.
2009-10-19 13:00:51 -07:00