Ticket #1009 (new task)

Opened 6 years ago

Last modified 5 years ago

[TRIVIAL] Lift osync_assert() parameter "validation" by osync_return_if_fail()/osync_return_val_if_fail() from public Interfaces

Reported by: dgollub Owned by: bricks
Priority: normal Milestone: OpenSync 0.40
Component: OpenSync: Application API Version: 0.38
Severity: trivial Keywords:


To provide an error/debug tolerant API we need to replace osync_assert() protection from all public interfaces.

This only affects the osync_assert() which check the parameter list at the functions head. Since building with NDEBUG would not do any protection and would cause a segfault right a way.

Instead replace osync_assert() with:

  • osync_return_val_if_fail(condition, retvalue) - to return also an value
  • osync_return_if_fail(condition) - to just return

Depending of the functions return type osync_return_val_if_fail() or osync_return_if_fail() is used. osync_return_if_fail() is only used for functions with return type void.

For now please skip plublic interfaces which have an OSyncError in their parameter list. This needs to be handled differently. Instead of osync_return_*if_fail() a proper error needs to be returned in individual cases.

Example porting is changeset r4932

Change History

comment:1 Changed 5 years ago by dgollub

  • Component changed from OpenSync to OpenSync: Application API

Still valid for trunk ...

comment:2 Changed 5 years ago by dgollub

  • Owner dgollub deleted
  • Priority changed from high to normal

comment:3 Changed 5 years ago by bricks

  • Owner set to bricks
Note: See TracTickets for help on using tickets.