fix examples in tutorial

SVN revision: 35851
This commit is contained in:
Vincent Torri 2008-09-06 09:14:54 +00:00
parent 108e5a3ee5
commit 1f3a6a7c5a
1 changed files with 18 additions and 1 deletions

View File

@ -255,7 +255,10 @@
*
* So one has to fisrt register all the error messages that a program
* or a lib should manage. Then, when an error can occur, use
* eina_error_set(), and when errors are managed, use eina_error_get().
* eina_error_set(), and when errors are managed, use
* eina_error_get(). If eina_error_set() is used to set an error, do
* not forget to call before eina_error_set0), to remove previous set
* errors.
*
* Here is an example of use:
*
@ -270,12 +273,16 @@
*
* voi *data_new()
* {
* eina_error_set(0);
*
* eina_error_set(MY_ERROR_NULL);
* return NULL;
* }
*
* int test(int n)
* {
* eina_error_set(0);
*
* if (n < 0)
* {
* eina_error_set(MY_ERROR_NEGATIVE);
@ -309,6 +316,16 @@
* eina_error_msg_get(err));
* }
*
* if (!test(0))
* {
* Eina_Error err;
*
* err = eina_error_get();
* if (err)
* printf("Error during test function: %s\n",
* eina_error_msg_get(err));
* }
*
* if (!test(-1))
* {
* Eina_Error err;