| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
xfree() should never be used directly and only be called by one of the
mem_*() wrappers.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
"bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
| |
Seen with "-Wunused-but-set-variable".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
| |
Spotted by clang-analyzer ("Assigned value is garbage or undefined").
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
| |
Lukas: Small formatting and logic changes.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
| |
Use spaces instead of tabs for source code indentation only, strip
trailing whitespaces from lines.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
| |
Patch submitted by Lukas Fleischer, thanks.
|
|
|
|
| |
Patch submitted by Lukas Fleischer, thanks.
|
| |
|
| |
|