|
|
楼主 |
发表于 2013-12-3 20:59:25
|
显示全部楼层
( ]4 g X. b1 Q$ W3 I
- U/ x% T: }7 H7 k& W6 E) b6 _: n
OF类型的变量一定要通过MEM_free()进行释放
! }/ k2 O6 `& Q* Qvoid MEM_free(void *pointer)
1 F7 ^$ K8 ^6 {8 i/ ~- ~
7 r7 k. F, m, o; W( Q5 \
- s3 `$ V4 z. s" w+ S2 N/ GMEM_alloc()
& S+ V3 q. G- y5 x2 x/ W4 `5 ~MEM_crealloc()
# T# U+ B9 c. P; CMEM_free()
0 `" [/ V$ e: R1 VMEM_realloc()& Y; }2 f4 _- h! i8 e
使用以上内存管理函数,也可以使用C内存管理函数2 q" ~8 i0 W2 @6 i/ h ^
Include file: <mem.h>
* j m$ u2 Q9 f" W# }; }7 l& e2 o6 j; i
( ^; c% h- z q/ E+ S; X' y
函数返回值不为ITK_ok,则有错误发生,必须进行处理
- b9 s. B0 O# b# x1 M) gEMH_ask_error_text() 和 EMH_ask_errors()通常用来获得错误信息(参考%IMAN_ROOT%\include\emh.h)
! C- Q4 D) e/ K0 a, A" M可以自定义错误信息编号,可用的自定义错误代号范围919000~919999。
. T- I/ T8 c8 n* ~& G8 A1 ]. S2 h; i$ r( _1 w6 a( @; _
* ? Z/ [+ E" G5 H8 `/ J# e( E$ f8 Z1 @) s' J% u4 S
( ]. u! ~' ^- N4 [& u9 o+ T
- status = AOM_save( );
2 q; E8 i' Z0 \, `0 E2 f% s - if (status != ITK_ok )
6 Y3 v5 @! V1 G9 ?8 T$ F3 J - {
7 o; M& e$ ]' a+ e - EMH_ask_error_text(status, &message);
$ {) E) v( T! P l - printf("Error with AOM_save: %s\n", message);8 n \( H! }3 v" f) Z- w h8 w
- MEM_free(message);3 n) e# L' \8 z8 y! e6 ?
- return status;$ H9 V: O, N. v2 Q/ K
- }, }; |& e: c4 j! e6 d! g
复制代码- status = AOM_save( fl_tag );
% Q! ~2 o8 z5 P7 i5 ~: W - if (status != ITK_ok )* J" B8 }9 t+ o! `
- {
5 Z# B) d6 ^7 L- |, x* { - EMH_ask_errors(&n_errors, &severities, &statuses, &messages);: Z* V" A2 I6 ] N# C3 h. C: j
- for (i = 0; i < n_errors; i++)& D- T4 R3 W- @8 _" _
- {8 a2 Z* V* b; M( L ?. B2 m& h5 a
- printf( " %6d: %s\n", statuses[i], messages[i] );
2 g: ?2 c9 {( Y, c" l - } y1 l6 D; X/ C* `
- return status;/ P# }$ s* W; z; T$ w& X
- }* B% X& @, q' K! Z& n
复制代码
+ v$ C1 u6 E$ Q, M% R: }4 {; J* ~) P+ Q1 S5 f) x, U! P9 `
& z& F7 p- u, q$ G$ h) e
|
|