There's a couple of problems with your mail-folder-cache code.

First, the args... macro parameter is entirely non portable, and is only
a gcc thing.

You need to change it to just accept 1 arg and use printf inside the
macro's like all the other debug macro's do.

You might like to define it as:

#define d(x) (printf("%s(%d): ", __FILE__, __LINE__, (x))

If you want more detailed output, or just x as usual.

Otherwise you wont even be able to compile it with anything but gcc
(it'll always complain about incorrect number of args).


Also, i see a problem with your locking.  You should have
get_folder_info() assume it already has a lock.  This wont cause
problems right now because folders are never forgotten (which of course
means the name 'cache' is incorrect), but when they are (and they will
need to be), then you have races.  So to make each operating atomic,
first lock, then find, then operate, then unlock, dont lock find,
unlock, lock, operate, unlock.  Using the folder_invalid flag is just
dumb.

Actually i dont even see what this whole bit of code is useful for, its
just duplicating code that was already there.  And moving it into a
resuable location doesnt help either because all folders will eventually
work the same way.




_______________________________________________
evolution-hackers maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/evolution-hackers

Reply via email to