Few suggestions

nsf no.smile.face at gmail.com
Wed Jun 18 00:45:07 CEST 2008


Hi.

I want to suggest few possible improvements that developers can do in
libev.

1) Include pkg-config .pc file to source distribution.
2) I wanted to compile my project (which is using libev) with -Wall and
without any warnings, but there is few bad macros in libev.h. So, I was
forced to remove all these macros and change them to ugly code.
You can see in this commit what I mean:
http://github.com/nsf/bmpanel/commit/60f74645be5e234f778d43621cbfc59d9f9d6cd8
(just search with browser string "ev_io_init" and look around)

I'm not a pro in C, but why are you using these type conversions in
macros:

-----------------------------------------------
#define ev_init(ev,cb_) do {			\
  ((ev_watcher *)(void *)(ev))->active   =	\
  ((ev_watcher *)(void *)(ev))->pending  =	\
  ((ev_watcher *)(void *)(ev))->priority = 0;	\
  ev_set_cb ((ev), cb_);			\
} while (0)
-----------------------------------------------

and

-----------------------------------------------
#define ev_timer_set(ev,after_,repeat_)     do { ((ev_watcher_time *)(ev))->at = (after_); (ev)->repeat = (repeat_); } while (0)
-----------------------------------------------

They will work without them. And also there will be no warnings in -Wall
mode.

I'm using gcc 4.3.0.

Thank you for your attention. :)



More information about the libev mailing list