Ticket #1009 (new task)
[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: | |
| Cc: |
Description
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

Still valid for trunk ...