Mercurial > hg > Members > kaito > longjump
changeset 5:4e7858590985
remove malloc , free and include<stdlib.h>
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 23 Nov 2013 23:31:02 +0900 |
parents | d75a89b10176 |
children | 509523ee1e27 |
files | global_longjump.c pointer_longjump.c |
diffstat | 2 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/global_longjump.c Thu Nov 14 13:16:46 2013 +0900 +++ b/global_longjump.c Sat Nov 23 23:31:02 2013 +0900 @@ -1,3 +1,8 @@ +/* + please use pointer version. that is spuerior to this. + */ + + #include <stdio.h> #include <setjmp.h> #include <stdlib.h>
--- a/pointer_longjump.c Thu Nov 14 13:16:46 2013 +0900 +++ b/pointer_longjump.c Sat Nov 23 23:31:02 2013 +0900 @@ -1,6 +1,5 @@ #include <stdio.h> #include <setjmp.h> -#include <stdlib.h> __code code1(int n,__code(*__return)(int,void *,int *),void *__environment,int *__ret_p){ printf("code1 : code entry1\n"); @@ -15,14 +14,14 @@ int main1 (){ __code (*__return)(); - void *__environment; + void *__environment ; int retval; int *__ret_p; + jmp_buf j_buf; __ret_p = &retval; printf("main1 : main1 entry\n"); - __environment = (void*)malloc(sizeof(jmp_buf)); + __environment = &j_buf; if (setjmp(__environment)){ - free(__environment); printf("main1 : main1 return\n"); return retval; }