First of all your functions are OK (from a source point of view, I have not run 
them in a debugger) they produce the output one expects them to do and hide 
libredwgs internal structure. Fine. 

To improve them or to keep in mind for the next functions you write here are 
some hints:


count_entity(...)
The function has the parameter "name" with witch the the name of an object is 
given. In nearly the whole body of the function there are string compares to 
match the DWG_TYPE with the "name". Instead of the name parameter the function 
could have a DWG_TYPE parameter which would eliminate all the strcmp calls.  

The object name as a string makes room for "misspelling" errors (searching for 
"Circle" instead of "CIRCLE")

If you want to stay with the parameter "name" you should try to move the strcmp 
calls outside of the while loop.


extract_lines(...)
Functions that allocate memory and left the user to free this memory are always 
problematic. But, why not.

The API must not hide the get_first/get_next functions. What the extract_XXX 
functions do the user should be able to do also without these functions.


Am 26.06.2013 um 09:32 schrieb gagan:

> On Sat, Jun 22, 2013 at 6:29 PM, gagan <[email protected]> wrote:
>> I have created a total of 5 functions till now. Please review these [
>> 0 ]. Tell me if these need any changes.
>> Like the way functions are created for extracting lines and circles,
>> we can have these for all entities since these avoid the low level
>> struct access.
>> 
>> [ 0 ] http://202.164.53.122/~gagan/gsoc/functions.c
> 
> Reply awaited.
> 
> -- 
> Thanks
> Gaganjyot
> http://codeify.wordpress.com
> "Jai Sai Naath"
> 


Reply via email to