Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: Gnelik on December 03, 2006, 01:44:28 PM

Title: Please help with porting of little lib.
Post by: Gnelik on December 03, 2006, 01:44:28 PM
It is lib for parsing math expressions.
The most problem is in memory managment.
please help!!!



[attachment deleted by admin, too old]
Title: Re: Please help with porting of little lib.
Post by: saratoga on December 03, 2006, 02:55:05 PM
If the calls to malloc are the only problem, it looks like you could just statically allocate memory for them.  Theres only two, and it looks like they're fairly small variables anyway (I think?).
Title: Re: Please help with porting of little lib.
Post by: Gnelik on December 04, 2006, 11:01:16 AM
I can't understand how to make it work with array :(.
I am going to write a graph builder but i can't continue without it. Please help me!
Title: Re: Please help with porting of little lib.
Post by: saratoga on December 05, 2006, 06:41:05 PM
Well since the variable you're mallocing space for is tydefed like so:

typedef struct ff_expr_s AVEvalExpr;

I'm not too surprised arrays don't work ;)
Title: Re: Please help with porting of little lib.
Post by: Bagder on December 06, 2006, 03:50:37 AM
Since the malloc()s are used to build trees etc in this code, I would advice having two arrays of structs, and then for each malloc() you pick one from the list to use and mark it as used - simulating malloc(). The number of array entries would need to be tweaked to work with a suitable worst case.