[Dovecot] Quota
Timo Sirainen
tss at iki.fi
Mon Apr 25 15:20:42 EEST 2005
On Mon, 2005-04-25 at 10:58 +0200, Thomas Wouters wrote:
> > quota-rquotad works, by the way; I'll clean it up a bit and provide a patch
> > against quota.tar.gz.
Just a few minor comments:
+ for (qr_idx = 0; qroots[qr_idx] != NULL; qr_idx++) {
+ /* NOTHING */;
+ }
Could be replaced with qr_idx = strarray_length(qroots);
+ root->root.quota = (struct quota *)quota;
I usually try to avoid casts whenever possible. If something is changed
you'll then get a nice compile time error instead of a runtime crash :)
So "a->quota would work instead..
+ if (statfs(((struct index_storage *)(mailbox_get_storage(box)))->dir,
+ &statbuf) < 0) {
+ return NULL;
+ }
And like I said in previous mail, iter_init() shouldn't return NULL..
You could eg. set iter->iter.offset = quota->nroot (so iter_next()
returns NULL) and add some iter->failure flag which iter_end() can then
return (it returns int in new quota plugin code).
+ strncpy(iter->boxfs, statbuf.f_mntonname, MNAMELEN);
strncpy() is evil. It's not NUL-terminating strings. Dovecot has
strocpy() which can be used I guess.. Or you could use dynamic string_t.
+ root->resources = p_new(root->pool, const char *, 1);
+ root->resources[0] = NULL;
No real need to set [0] to NULL as p_new() always initializes the memory
with zeros (and Dovecot relies on that in several places already).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://dovecot.org/pipermail/dovecot/attachments/20050425/f5d7f101/attachment-0001.bin>
More information about the dovecot
mailing list