- Timestamp:
- Jan 31, 2018, 9:44:40 AM (8 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libohana/src/errors.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libohana/src/errors.c
r31635 r40328 1 1 # include "ohana.h" 2 2 3 static char errorline[1024]; 3 int Nline = 0; 4 int NLINE = 0; 5 char **errorlines = NULL; 4 6 5 7 int init_error () { 6 8 7 bzero (errorline, 1024); 9 if (!errorlines) { 10 NLINE = 10; 11 ALLOCATE (errorlines, char *, NLINE); 12 for (int i = 0; i < NLINE; i++) { 13 errorlines[i] = NULL; 14 } 15 } 16 17 for (int i = 0; i < NLINE; i++) { 18 FREE (errorlines[i]); 19 errorlines[i] = NULL; 20 } 21 22 Nline = 0; 23 8 24 return (TRUE); 9 25 } … … 11 27 int push_error (char *line) { 12 28 13 bzero (errorline, 1024); 14 strncpy (errorline, line, 1023); 29 errorlines[Nline] = strcreate (line); 30 Nline ++; 31 32 if (Nline >= NLINE) { 33 NLINE += 10; 34 REALLOCATE (errorlines, char *, NLINE); 35 for (int i = Nline; i < NLINE; i++) { 36 errorlines[i] = NULL; 37 } 38 } 39 15 40 return (TRUE); 16 41 } … … 18 43 int print_error () { 19 44 20 gprint (GP_ERR, "%s\n", errorline); 45 for (int i = 0; i < Nline; i++) { 46 gprint (GP_ERR, "%s\n", errorlines[i]); 47 } 48 49 init_error(); 50 21 51 return (TRUE); 22 52 }
Note:
See TracChangeset
for help on using the changeset viewer.
