Auto-clear

Cristian KLEIN cristiklein at gmail.com
Sat Jan 30 10:34:39 EST 2010


Hi,

On 30/01/2010 03:20, Yawar Amin wrote:
> On 1/29/10 5:44 PM, Cristian KLEIN said:
>> Please review and give your opinions about a feature I would like to
>> add to GnuCash called "auto-clear". [1]
 >
> I just have some minor nitpicks, but I'm not sure of the proper way to
> comment on a patch in Bugzilla (and my application for a Bugzilla
> account hasn't gotten a response yet) so I'm going to reference lines in
> the patch by quoting them and their line number. Here goes:
>
> 273. +  "ActionsAutoCleanAction",
>
> Shouldn't this be:
>
> "ActionsAutoClearAction",

Typo. Fixed.

> 344. + * published by the Free Software Foundation; either version 2 of   *
> 345. + * the License, or (at your option) any later version.              *
>
> Can parts of GnuCash be distributed under GPL v2 or later while others
> are distributed as GPL v2 only? Are these two licensing options
> compatible? I'm just raising this because of the recent thread (
> http://lists.gnucash.org/pipermail/gnucash-devel/2010-January/thread.html#27208
> ).

I just to the header from some random file inside the GnuCash tree. I'll 
be happy to adapt the copyright header to whatever the GnuCash community 
expects.

> 464. +    Split *split = node->data;
> 482.
> 496.
>
> Since node->data has type gpointer (or void*), maybe we should cast this:
>
> Split* split = (Split*)(node->data);

I don't understand why GCC didn't fire up an error, but I agree the cast 
should be there.

> The auto-clear algorithm itself seems very clever and completely over my
> head right now :-) but I'll keep looking at it.

It's just a version of the knapsack problem, where I used a GHashTable 
instead of an array. Each hash table entry has the key equal to an 
amount we can reach and the value to the last Split we used in order to 
reach that amount. If the value is NULL, it means we can reach that 
amount using multiple solutions (no-go for GnuCash).

> Thanks for putting this up,

Thank you for your comments.

Cristi.



More information about the gnucash-devel mailing list