add new errterm() function, to cleanup. Reference: /n/patches.lsub.org/patch/errterm Date: Tue May 15 18:08:30 CES 2012 Signed-off-by: nemo@lsub.org --- /sys/man/2/error Fri Apr 20 17:10:22 2012 +++ /sys/man/2/error Fri May 11 18:51:34 2012 @@ -22,6 +22,10 @@ .br .B int errstacksize(void) +.PP +.B +void errterm(void) +.br .SH DESCRIPTION These routiles are tools for error handling. .IR catcherror , @@ -39,7 +43,9 @@ .I Errinit should be called before using any other. It should be called by each thread/process using the error handling mechanism. Its argument, -indicaties the desired depth of the error stack for the calling process. +indicaties the desired depth of the error stack for the calling process. Before exiting, +.I errterm +may be called to release the memory used for the error stack. .PP .I Catcherror install an exception handling point. --- /sys/include/error.h Fri Apr 20 17:10:22 2012 +++ /sys/include/error.h Fri May 11 18:50:16 2012 @@ -12,6 +12,7 @@ #pragma varargck argpos error 1 void errinit(int stack); +void errterm(void); void noerror(void); int errstacksize(void); void error(char* msg, ...); --- /sys/src/liberror/error.c Fri Apr 20 17:10:22 2012 +++ /sys/src/liberror/error.c Fri May 11 18:54:01 2012 @@ -18,6 +18,12 @@ e->nlabel = stack; } +void +errterm(void) +{ + free(*__ep); +} + int errstacksize(void) {