Archived
1
0
Fork 0
Commit graph

90 commits

Author SHA1 Message Date
212eeb073e adding dlight-dlhist-read 2013-10-17 20:51:22 +02:00
697d512ea6 lockfile: Remove force parameter from hold_lock()
If user wants to 'force' a lock, he/she will have to remove the file
manually. some wierd race conditions may happen if different processes optains the
same lock at any given time (thats why lockfile is implemented in the first place)
So lockfile API should not in any circumstances directly provide a way to force taking a lock.
2013-10-17 15:57:42 +02:00
c731173b49 lockfile.c: in hold_lock(), Should report 'filename' instead of 'lock->name' if file is locked 2013-10-17 15:52:03 +02:00
61cad77a0c lockfile.c: Adding mechanism to take a lock of a file after a given amount on time. even if the file is locked. 2013-10-17 15:47:10 +02:00
d779db6715 Adding version generation script for Makefile. 2013-08-22 10:11:50 +02:00
39b8fb640f Adding additional command line flags for help and version. 2013-08-22 10:11:50 +02:00
d1fca80734 Adding version.c 2013-08-22 10:11:48 +02:00
e85b3b7993 dlhist.c: use file_cmp from utils.h instead of static path_cmp. 2013-02-08 21:55:12 +01:00
c1b99a9e7e Adding utils.c. 2013-02-08 21:54:54 +01:00
e78f8bea4d hash.c: use xalloc 2012-10-14 14:53:42 +02:00
891e438a7a Adding dynamic array datastructure. 2012-08-29 11:40:50 +02:00
ff54ec830d Makefile: add -D__DEBUG__ symbol.
xalloc.c uses this symbol to provide additional debugging
information. This patch adds support to make to define this symbol
when running:

$ make DEBUG=1
2012-08-27 17:20:49 +02:00
fe4d64e288 Adding xalloc 2012-08-27 17:20:49 +02:00
223706d52f hash: Replace struct with a primitive type for hash values.
Remove the struct hash_entry and define a new type for hash values.
Most likely we will only need one member in this struct. and instead
of just using unsinged int. let's name a new type for clarity.
2012-08-22 15:42:20 +02:00
569d0167d8 sha1_io: inline functions 2012-08-22 14:26:58 +02:00
ee17b5e370 buffer.c: fix 'off-by-one' error in 'buffer_expand' 2012-08-09 16:23:01 +02:00
484dadc916 buffer.c: fix 'off-by-one' error in 'buffer_cstr()' 2012-08-09 16:13:49 +02:00
107aae0105 env.c: free memory at exit.
Make sure the memory for the 'base' string is always free'd
when the program exits.
2012-08-09 16:00:20 +02:00
b65c9e74aa dlhist.c: don't include '\n' in calls to error() 2012-08-15 15:43:38 +02:00
4a8fcb6062 dlhist.c: Fix typo in dlhist_flush() 2012-08-15 15:43:38 +02:00
deef8a6c1a env.c: Try create base directory on every call to env_get_dir()
Not a huge performance loss anyway. And the directory may be deleted
between calls so. However the directory can still be missing as soon
as the mkdir() call has ended.

Doing it this way just means that if the directory is removed during
execution of the program, it will be created again and not make the
rest of the programs lifetime live without it.
2012-08-15 15:43:08 +02:00
b967d1b147 proc-cache.c: free entries in the hash table. 2012-07-18 19:27:17 +02:00
13330c322d buffer.c: generate an warning instead of error in buffer_write() 2012-07-17 10:43:20 +02:00
313816c425 error.c: let warn() return an int 2012-07-17 10:42:41 +02:00
dea5aa6fe0 Makefile: dont optimize when compiling with '-g' flag. 2012-07-12 10:34:22 +02:00
52777c2ff8 buffer.c: fix 'off-by-one' error when indexing array. 2012-07-04 14:01:04 +02:00
d18d581fd0 buffer.c: fix dereference of invalid pointer.
using the pointer 'b->block' when it is possible that
reallocation has moved the memory to another location.
'b->block' may therefore be an invalid pointer in some
cases. use 'ret' intead.
2012-07-04 13:53:33 +02:00
ae91737fb1 proc-cache.c: lazy delete
Use lazy delete mechanism to remove the need for linked list delete.
This removes the need for a sentinel node at the beginning.
2012-07-04 12:02:42 +02:00
51f7286ab8 dlight.c: move call to proc_cache_update()
proc_cache_update() should be called after we have walked through
the list of filters. Not on every filter.
2012-06-28 17:06:42 +02:00
d49b1b2456 dlight.c: Mark item in download history earlier.
It is more correct to mark an item as downloaded right after
it is actually fetched and not after it is successfully written to disk.
2012-06-28 17:02:14 +02:00
365b657f9f proc-cache.c: use hash-table code from hash.c
Use the refactored code from hash.c also
use chaining as the collision strategy instead of
open-adressing, not only becouse the new hash api makes it hard
to do but it is more space efficient.

Since a collision with open-adressing results in two entries
in the hash table but with chaining, we only have one.
the complexity for search/insert/delete is still O(n) for both techniques.
Chaining is better because items that collide only takes up one slot in the
hash table, considering that the best-case for space overflow is 25%. it
is better to have a small table.
2012-05-22 11:48:28 +02:00
8a39596268 llist.h: Adding a Single linked list implementation
Needing this for implementing chaining on hash collisions and
iam tired of implementing dynamic arrays / linked lists every time.
2012-05-21 21:15:27 +02:00
269ddffa78 dlight.c: use buffer_write() 2012-05-23 22:05:16 +02:00
4c664f2400 buffer: add buffer_write() 2012-05-23 22:05:16 +02:00
e0976e0d23 proc-cache.c: remove proc_cache_flush()
flush() is redundant, it makes more sense to just write the file on close().
There is no reason why you want to commit the current state of the cache to disk
at any other time then when closing the application.
2012-04-17 21:14:49 +02:00
4f05a5ae4f proc-cache.c: use hash-table code from hash.c 2012-04-12 07:46:28 +02:00
5193e8453c hash.c: refactor out common hash table code
both dlhist.c and proc-cache.c uses similar hash table code.
factor this out into a helper interface.
2012-04-11 21:09:28 +02:00
c1198121bb cconf.c: use sha1_io.h 2012-02-17 23:30:49 +01:00
0b2b159b2d Adding sha1_io.c/h: A wrapper interface for performing posix file I/O
with SHA1 as a CRC mechanism.

When writing file formats using SHA1 as CRC, its is handy to
have SHA1_Update() to be applied to every write(). so that an
SHA1 hash can be calculated for that data and used as an CRC check.

Therefor this interface is created to wrap the code used to do this.
2012-02-17 22:37:24 +01:00
37ba894802 make dlight.c use the new dlhist 2011-12-15 13:35:13 +01:00
40e6afeffa adding new dlhist.c 2011-12-15 13:29:23 +01:00
1350330dd2 dlhist: rename to proc-cache.
A new datastructure is about to take dlhist place. dlhist is currently
implemented as a mixture of an "process cache" that should record what
rss items has been processed (that is why the url is used as a unique
identifier), but right now it only stores an url if it has been
downloaded. A new datastructure that should be "download history"
shall be implemented, that will keep track of what title and where
it has been downloaded to. this will make it possible to only
download an rss title to a location once.

Splitting this datastructure into two separated structures is trivial
as a "process cache" will threat URL's as a unique identifier and
a "download history" will threat the title in an rss item as a
unique identifier (and also track it's destinations).

This commit does not change any functionality, I just rename
this to keep the "dlhist" prefix and source files clear for
when implementing the real dlhist.
2011-11-14 16:11:18 +01:00
90365e9de2 dlight.c: do not call perror when dlhist_open() fails 2011-11-05 16:45:43 +01:00
dcd515b4b1 http.c: use buffer.h 2011-11-05 15:18:19 +01:00
6456ac58bc env.c: use buffer.h 2011-11-05 15:18:19 +01:00
710f761cc6 buffer: adding buffer_cstr_release 2011-11-05 15:18:19 +01:00
5245d19d71 moving strbuf to buffer 2011-11-05 15:18:19 +01:00
5220e42038 Adding strbuf.
lifting a portion of the strbuf api/implementation found in archived.
This will serve as a base for an generic buffer api.
2011-11-05 15:18:19 +01:00
378de035de dlhist.c: dlhist_lookup: pass a variable to he_empty().
he_empty() is a macro, do not pass a function call as argument.
when the macro expands, the function will be called numerous times.
2011-11-03 14:36:10 +01:00
a0f46daa4a dlhist.c: store number of entries in header instead of table size
Now that table size can be calculated, lets store the number of entries
instead of size in the header so we can rely on that when reading
entries, instead of the actual size on disk. this is safer if data is
appended to the file outside of the application.
2011-11-03 13:42:59 +01:00