Changeset 102
- Timestamp:
- 08/30/11 18:51:01 (21 months ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
-
pspio_error.c (modified) (3 diffs)
-
pspio_error.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/pspio_error.c
r95 r102 24 24 25 25 26 int pspio_error_add(const int id, constchar *filename, const long line) {26 int pspio_error_add(const char *filename, const long line) { 27 27 int s; 28 28 pspio_error_t *last_err; … … 34 34 } 35 35 36 pspio_error_chain->id = id;36 pspio_error_chain->id = pspio_error_tmp_id; 37 37 pspio_error_chain->line = line; 38 38 pspio_error_chain->next = NULL; … … 58 58 } 59 59 last_err = last_err->next; 60 last_err->id = id;60 last_err->id = pspio_error_tmp_id; 61 61 last_err->line = line; 62 62 last_err->next = NULL; -
trunk/src/pspio_error.h
r95 r102 26 26 * @brief Error codes and handlers 27 27 */ 28 29 #include <stdlib.h> 28 30 29 31 #if defined HAVE_CONFIG_H … … 61 63 } pspio_error_t; 62 64 63 static pspio_error_t *pspio_error_chain; 65 /* The following is a VERY bad trick. Whoever finds better is welcome to 66 * speak. */ 67 static int pspio_error_tmp_id = 0; 68 static pspio_error_t *pspio_error_chain = NULL; 64 69 65 70 … … 68 73 * @param[in] new_error: new error to add 69 74 */ 70 int pspio_error_add(const int id, constchar *filename, const long line);75 int pspio_error_add(const char *filename, const long line); 71 76 72 77 … … 84 89 */ 85 90 #define HANDLE_ERROR(FUNCTION_CALL, TYPE_TO_FREE, VAR_TO_FREE) \ 86 int ierr_macro; \ 87 ierr_macro = FUNCTION_CALL; \ 88 if ( ierr_macro != PSPIO_SUCCESS ) { \ 91 pspio_error_tmp_id = FUNCTION_CALL; \ 92 if ( pspio_error_tmp_id != PSPIO_SUCCESS ) { \ 89 93 pspio_ ## TYPE_TO_FREE ## _free(VAR_TO_FREE); \ 90 pspio_error_add( ierr_macro, __FILE__, __LINE__); \91 return ierr_macro; \94 pspio_error_add(pspio_error_tmp_id, __FILE__, __LINE__); \ 95 return pspio_error_tmp_id; \ 92 96 } 93 97 #endif 98 99
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/trac/libpspio/chrome/site/your_project_logo.png)