summaryrefslogtreecommitdiffstats
path: root/src/recur.c
Commit message (Collapse)AuthorAgeFilesLines
* Mark localized string literals constantLukas Fleischer2012-04-051-10/+10
| | | | | | | Translated strings returned by gettext() are statically allocated and shouldn't be modified. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2012-03-261-1/+1
| | | | | | Add 2012 to the copyright range for all source and documentation files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use strcmp() instead of strncmp()Lukas Fleischer2012-03-121-1/+1
| | | | | | | | | strncmp() isn't intended to be a secure strcmp() replacement, it is designed to be used if you want to compare the first n characters of two strings. Since we always compare character pointers with string literals, switch to using strcmp() everywhere. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix up fscanf() format stringsLukas Fleischer2012-02-191-1/+1
| | | | | | | All members of the tm structure are signed integers. Stick to using the correct fscanf() format specifiers for these. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Trap fgets() failure in *_scan()Lukas Fleischer2012-02-181-2/+6
| | | | | | | | Ensure we don't read arbitrary data when fgets() returns a NULL string (meaning that either the EOF is encountered or an error occurred). This also fixes a couple of compiler warnings seen with "-Wunused-result". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use a global configuration variableLukas Fleischer2011-11-141-4/+4
| | | | | | | This is one of the few valid use cases for a global variable. No need to make it pseudo-local and pass it from one function to another. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove parentheses from return statementsLukas Fleischer2011-11-021-24/+24
| | | | | | | | | | | | | | No reason to use "return (x);" here. Refer to the GNU coding guidelines for details. Created using following semantic patch: @@ expression expr; @@ - return (expr); + return expr; Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not cast unused return values to voidLukas Fleischer2011-11-021-52/+46
| | | | | | | | | | | | | | | | | | | | A small style fix that removes all remaining "(void)" casts. Using these isn't encouraged in GNU coding guidelines and doesn't serve a certain purpose, except for satisfying a few static code analysis tools. We already nuked some of these in previous patches, but this semantic patch should fix what's left: @@ identifier func; @@ - (void)func ( + func ( ...); Long lines were re-formatted manually. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid use of printf()/fprintf()Lukas Fleischer2011-11-021-4/+4
| | | | | | | | | | | | | | | | Use one of the following functions where appropriate: * puts() (whenever we print hard coded strings to stdout) * fputs() (whenever we print hard coded strings to a stream) * putchar() (whenever we print a single character to stdout) * fputc() (whenever we print a single character to a stream) * strncpy() (whenever we copy hard coded strings to a buffer) This removes the overhead introduced by the format string parser and reduces the number of false positive C-format strings spotted by xgettext(1)'s heuristics. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/recur.c: Speed up recur_item_find_occurrence()Lukas Fleischer2011-11-021-0/+3
| | | | | | | Bail out early if we check for a date beyond the item's repetition end date. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid unnecessary start time calculationsLukas Fleischer2011-10-211-11/+46
| | | | | | | | | | | | | | Rename recur_*_inday() to recur_*_find_occurrence() and use the new functions whenever we actually care about the start time of an occurrence. Reintroduce recur_*_inday() as wrappers to recur_*_find_occurrence() and pass NULL as start time buffer (which means "skip start time calculation"). Keep using these when we only want to know if a recurrent item belongs to a specific day but do not care about the actual start time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/recur.c: Remove diff_weeks()Lukas Fleischer2011-10-211-10/+3
| | | | | | After our recur_item_inday() rewrite, this function is no longer used. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/recur.c: Support recurrent multi-day appointmentsLukas Fleischer2011-10-211-45/+50
| | | | | | | | | | | | | Completely rewrite our inday algorithm in recur_item_inday() and be more fine-grained. This version can deal with recurrent multi-day appointments unless they overlap. In case of overlapping appointments, only the last appointment that starts before the current day is shown. We will need to rewrite the whole recur_item_inday() interface in order to fix this - this relatively trivial patch is only the first step. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Pass item durations to recur_item_inday()Lukas Fleischer2011-10-211-5/+5
| | | | | | | | Having item's durations eventually allows for better parsing of recurrent appointments as we might be interested in how many days are covered by a multi-day appointment. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Make events start on 00:00 (12:00 a.m.)Lukas Fleischer2011-10-211-3/+3
| | | | | | | | There is absolutely no reason to make events start on noon, 12:00. Switching to 00:00 seems totally reasonable here, and makes event handling a bit easier, also. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not unlink() note files on note removalLukas Fleischer2011-10-051-17/+13
| | | | | | | | | | Now that we use hash-based note file names, note files should never be unlinked as a note file might be shared. Also, remove the ERASE_FORCE_KEEP_NOTE flag that no longer makes any sense. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Merge branch 'maint'Lukas Fleischer2011-07-301-8/+9
|\
| * Fix recurrent appointment notificationLukas Fleischer2011-07-291-6/+3
| | | | | | | | | | | | We probably broke this in 9fab24818a119aef08b9726f6c1cd31d5434ce34. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Update the notification item in *_paste_item()Lukas Fleischer2011-07-291-0/+4
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Add "force" parameter to notify_check_next_app()Lukas Fleischer2011-07-291-2/+2
| | | | | | | | | | | | | | | | This allows to force notify_check_next_app() to update the notification appointment, even if start times are equal (e.g. if the item description was changed). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Make recur_*_write() publicLukas Fleischer2011-07-021-2/+2
|/ | | | | | | This allows one to serialize and send recurrent items to arbitrary output streams. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix whitespace issuesLukas Fleischer2011-06-091-2/+2
| | | | | | Strip trailing whitespaces in all source files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright notices in source files, documentation and "COPYING".Lukas Fleischer2011-04-221-1/+1
| | | | | | | | | * Update copyright dates (use 2004-2011 as date range everywhere). * Change copyright holder from "Frederic Culot" to "calcurse Development Team". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for recurring item exceptions.Lukas Fleischer2011-04-221-108/+81
| | | | | | | | | Rename "days" structure to "excp" which seems to be a better name here. Use generic linked lists of excp structures instead of using the "days" structure which again contains a linked list implementation. Do some cleanups and invocation fixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for recurring apointments and events.Lukas Fleischer2011-04-191-287/+216
| | | | | | | | Use them instead of "recur_apoint_list" and "next" pointers in "recur_event" type variables. Includes some code simplifications and cleanups. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add recur_apoint_inday() and recur_event_inday().Lukas Fleischer2011-04-191-0/+14
| | | | | | | | | | | | To be used with llist_fn_match_t callbacks later. I feel a bit ill adding those functions. This definitely is a hack. Ultimately, there should be some generic recur_item_inday() function that accepts both recurring apointments and events (or some wrapper structure) instead of parameter galeere. This is not the right place to fix that tho. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Compare pointers to "NULL" instead of "0".Lukas Fleischer2011-04-051-18/+18
| | | | | | "bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove dead assignments spotted by clang-analyzer.Lukas Fleischer2011-04-031-10/+4
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use upper case for macro names.Lukas Fleischer2011-03-151-4/+4
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Overall indentation fixes.Lukas Fleischer2011-03-141-200/+200
| | | | | | | Use spaces instead of tabs for source code indentation only, strip trailing whitespaces from lines. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update website links to match the new URL.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update mail addresses to match the new mailing lists.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove CVS "$Id" headers.Lukas Fleischer2011-03-031-2/+0
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fixed file permissions.Lukas Fleischer2011-03-031-0/+0
|
* Make parse_date accept several short forms.Lukas Fleischer2011-01-111-2/+2
| | | | | | | | | Short forms are only accepted in interactive mode (e.g. when using the "Go to" function, editing a recurrent item's end date, and so on). Samples: "1/1/30" for "01/01/2030", "26" for the 26th of the currently selected month/year or "3/1" for Mar 01 (or Jan 03, depending on the date format) of the currently selected year.
* All headers gathered into a single one. Typedefs suppressed.Frederic Culot2010-03-201-73/+67
|
* Patch to correct the wrong calculation of recurrent items' dates after aFrederic Culot2010-03-081-7/+74
| | | | turn of year (submitted by Lukas Fleischer, thanks!).
* Make use of erase_note() whenever possible.Frederic Culot2009-07-191-31/+25
|
* Switch to BSD license.Frederic Culot2009-07-051-14/+26
|
* The buffer should be allocated dynamically, but I am quite busy right now ↵Frederic Culot2009-05-221-5/+5
| | | | :'( Anyway, thanks Kamil for feedback
* more code cleanupFrederic Culot2009-01-031-20/+30
|
* various bugfixesFrederic Culot2009-01-021-18/+19
|
* cut/paste feature adedFrederic Culot2009-01-011-85/+295
| | | | | fixed a 2-years old bug that made repeated items with exceptions to load uncorrectly in some cases (thanks Jan for reporting it)
* Added wrappers around libc's memory management functions, to easily debug ↵Frederic Culot2008-12-281-58/+91
| | | | memory usage
* small bugfixes and code cleanupFrederic Culot2008-12-141-43/+22
|
* exceptions now properly taken into account while exporting dataFrederic Culot2008-12-141-19/+1
|
* daylight saving time related problems fixed (thanks youshe and Jan for ↵Frederic Culot2008-12-131-9/+6
| | | | reporting them)
* code cleanupFrederic Culot2008-12-121-3/+3
|
* color configuration menu adapted to handle user-defined key bindingsFrederic Culot2008-12-081-2/+2
|
* Checks added while loading key bindings configuration.Frederic Culot2008-12-071-7/+7
|