libredwg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libredwg] LibreDWG review


From: Pero Brbora
Subject: [libredwg] LibreDWG review
Date: Wed, 01 Apr 2015 00:10:01 +0200
User-agent: Internet Messaging Program (IMP) H4 (5.0.23)

this is LibreDWG review.

MACROS

Macros are both usefull and evil. Maybe its time to convert macros to functions (one file for each object/entity for example).

Usefull command line:
---
gcc -I. -E -P -C $f | sed '/^\#/d' | indent > demacro-$f
---
which expands macros, leaves comments, inserts headers verbatim, removes line marks (sed) and indents code is a good start.

After I read resulting files, noticed that logging is not enabled in bits.c because DWG_LOGLEVEL is not defined before including logging.h header.


BITCODE TYPES

Some bitcode types are defined as unsigned (bitshort for example). This is not by the specification. Functions returning bitcode types should follow those types (currently not the case).

Note that everything can be done with only three basic C types: char, int and double. Also consider using stdint.h.


MEMORY

Dwg free API function only frees header section!? Better memory handling is needed.

Consider central memory functions which then calls malloc/free. Also memory structure is needed to keep track of allocated memory.


MAKEFILE

GCC option -Wall is not used!? Here are some warnings when using -Wall option is used:
---
dwg_api.c: warning: control reaches end of non-void function
dwg_api.c: warning: 'ret_obj' may be used uninitialized in this function
---

Also what is the purpose of api.[ch] source files, they seem to be duplicates of dwg_api.[ch] files?


That's it for now.
Thank you, bye




reply via email to

[Prev in Thread] Current Thread [Next in Thread]