summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-04-19Add macros to use for thread-safe linked lists.Lukas Fleischer
Add LLIST_TS_* macros in a fashion similar to the already existing LLIST_* macros. Unlike the non-thread-safe version, these include LLIST_TS_LOCK and LLIST_TS_UNLOCK which can be used to lock (and unlock) a list (hence the thread-safety). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19Add macros for linked list operations.Lukas Fleischer
Mostly in preparation to the pending thread-safe list macros. This way, we have a similar interface to thead-safe and non-thread-safe lists. This also adds LLIST_FOREACH and LLIST_FIND_FOREACH macros which can be used as shortcuts when iterating over all list items or a subset of list items that is accepted by a callback function. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19Add linked lists implementation.Lukas Fleischer
As discussed on the mailing lists, the various linked list implementations we currently use at a dozen of different places in the calcurse source tree are inconvenient and should be replaced by a single generic solution. This is a first approach to introduce such a generic implemetation. It provides following functions: * llist_init(): Initialize a list. * llist_free_inner(): Loop through a list and free all items. * llist_free(): Free the list itself (but not the individual items). * llist_first(): Get the first item of a list. * llist_nth(): Get the nth item of a list. * llist_next(): Get the successor of a list item. * llist_find_first(): Find an item using a callback function. * llist_find_next(): Find the next match using a callback function. * llist_find_nth(): Find the nth item in a list (using a callback). * llist_get_data(): Get a pointer to the actual data of a list item. * llist_add(): Add an item at the end of a list. * llist_add_sorted(): Add an item to a sorted list (using a comparison callback function). * llist_remove(): Remove an item from a list. Linked lists are stored in "llist_t" structures, list items are to be stored in "llist_item_t" structs. All of the llist_*() functions either expect a pointer to a llist_t structure (in case the function operates on the list itself) or a pointer to a llist_item_t (llist_*_next() and llist_get_data()). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-17Use mem_free() instead of xfree() in check_time().Lukas Fleischer
xfree() should never be used directly and only be called by one of the mem_*() wrappers. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12Fix io_file_is_empty() behaviour when file starts with a newline.Lukas Fleischer
Read second byte if the first byte is a newline character to ensure the file doesn't contain any further data. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12Use do-while loops when reading start time and duration in apoint_add().Lukas Fleischer
Using do-while loops seems more appropriate here as "item_time" hasn't even been read when either of the loops are entered. Spotted by clang-analyzer. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12Fix null pointer dereference in parse_date().Lukas Fleischer
Passing a date in format "mm-dd-yy" where short forms are not allowed would lead to a null pointer dereference here. This one fixes that. Spotted by clang-analyzer. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12Remove some more dead assignments spotted by clang-analyzer.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12Declare exit_calcurse() "noreturn".Lukas Fleischer
Functions that never return should be declared "noreturn" to tell the compiler this fact. Also, clang-analyzer will detect this attribute and take it into account when running scan-build. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12Drop empty notes after editing.Lukas Fleischer
Keeping empty notes doesn't make sense here. Also, there doesn't seem to be a simple way to erase notes yet. This will make calcurse delete any notes that are empty (meaning that they are either 0-byte files or contain nothing but a newline character) when returning from the editor. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-11Update and cleanup ".gitignore".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-11Add more detailed instructions on `tx push` usage to documentation.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-11Add base transifex-client configuration file.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-11Use HTTPs for tx(1) samples in the documentation.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-10Update portable object files.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-10Update "calcurse.pot".Lukas Fleischer
Renegerate the catalog file with our new xgettext options. Drop line numbers. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-10Add "--no-location" to xgettext options.Lukas Fleischer
Disable line numbers in portable object files. They are not very useful and generate a lot of junk on every update, hiding the actual changes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-10Fix Transifex resource slug in documentation.Lukas Fleischer
The slug of the "calcurse.pot" resource has been changed from "calcurse-pot" to "calcursepot" for consistency reasons. Update the documentation where necessary. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-05Fix bad use of unsigned integers.Lukas Fleischer
Unsigned values should never be compared to values less than zero. Detected with "find_unsigned.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-05Compare pointers to "NULL" instead of "0".Lukas Fleischer
"bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-03Remove unused variables from wins_show().Lukas Fleischer
Seen with "-Wunused-but-set-variable". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-03Remove dead assignments spotted by clang-analyzer.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-03Avoid assignment of undefined value in parse_date().Lukas Fleischer
Spotted by clang-analyzer ("Assigned value is garbage or undefined"). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-29ignore the lock file if the pointed process is dead.Erik Saule
Lukas: Small formatting and logic changes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-15Update translation help in the manual.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-15Add note on dropped translations to the manual.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-15Try to stick to the GNU coding standards for the sake of consistency.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-15Use upper case for macro names.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-14Remove "ChangeLog".Lukas Fleischer
After some discussions on the mailing lists, we decided to remove the GNU-style ChangeLog, as turned out to be very inconvenient. Also, it merely is a replication of the Git log. If you need a similar ChangeLog, use `git log` (or `git log --stats`) instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-14Overall indentation fixes.Lukas Fleischer
Use spaces instead of tabs for source code indentation only, strip trailing whitespaces from lines. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-13Add russian translation.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-13Parse appointment end times correctly if they date back.Lukas Fleischer
End times used to be parsed incorrectly if start and end time's hour components were equal, but the end time was smaller than the start time. This is fixed by comparing the minute components as well in case of equal hour components. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-05Clean up updatestring() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-05Simplify date_sec2date_fmt() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-05Clean up and simplify line editing functions.Lukas Fleischer
This greatly simplifies all line editing functions - especially getstring() and showstring(). showcursor() is removed and integrated into showstring(). del_char() and add_char() are simplified as well. add_char() is renamed to ins_char(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-05Ensure key descriptions in status bar are always null-terminated.Lukas Fleischer
Key descriptions are just strncpy()'ed to key[], with KEYS_KEYLEN as maximum character count. This leads to a non-null-terminated string if the source pointer actually points to a string with a length of KEYS_KEYLEN bytes. Always appending a null character fixes this. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Remove unnecessary casting variables from get_item_{hour,min}().Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Fix mail address of release announcement list.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Update website links to match the new URL.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Update mail addresses to match the new mailing lists.Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Reformat "src/Makefile.am".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify date_sec2date_str() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Remove date_sec2hour_str() from "utils.c".Lukas Fleischer
date_sec2hour_str() is superseded by date_sec2date_str() with "%H:%M" as date format string, so replace all invocations and remove that function from "utils.c". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify date2sec() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify check_time() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify print_in_middle() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Reformat erase_window_part() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify get_item_hour() and get_item_min() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify str_toupper() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04Simplify file_close() in "utils.c".Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>