@@ -1047,7 +1047,11 @@ int examplef(Dwarf_Debug dbg,Dwarf_Error *error)
10471047 dwarf_globals_dealloc (dbg , globs , count );
10481048 return DW_DLV_OK ;
10491049}
1050+ /*! @endcode */
10501051
1052+ /*! @defgroup exampleg Example of dwarf_get_pubtypes use
1053+ @code
1054+ */
10511055int exampleg (Dwarf_Debug dbg , Dwarf_Error * error )
10521056{
10531057 Dwarf_Signed count = 0 ;
@@ -1065,7 +1069,11 @@ int exampleg(Dwarf_Debug dbg, Dwarf_Error *error)
10651069 dwarf_types_dealloc (dbg , types , count );
10661070 return DW_DLV_OK ;
10671071}
1072+ /*! @endcode */
10681073
1074+ /*! @defgroup exampleh Example of dwarf_get_weaks use
1075+ @code
1076+ */
10691077int exampleh (Dwarf_Debug dbg ,Dwarf_Error * error )
10701078{
10711079 Dwarf_Signed count = 0 ;
@@ -1083,7 +1091,11 @@ int exampleh(Dwarf_Debug dbg,Dwarf_Error *error)
10831091 dwarf_weaks_dealloc (dbg , weaks , count );
10841092 return DW_DLV_OK ;
10851093}
1094+ /*! @endcode */
10861095
1096+ /*! @defgroup examplej Example of dwarf_get_funcs use
1097+ @code
1098+ */
10871099int examplej (Dwarf_Debug dbg , Dwarf_Error * error )
10881100{
10891101 Dwarf_Signed count = 0 ;
@@ -1101,94 +1113,46 @@ int examplej(Dwarf_Debug dbg, Dwarf_Error*error)
11011113 dwarf_funcs_dealloc (dbg , funcs , count );
11021114 return DW_DLV_OK ;
11031115}
1116+ /*! @endcode */
11041117
1105- void examplek (Dwarf_Debug dbg )
1106- {
1107- Dwarf_Error error = 0 ;
1108- Dwarf_Func * funcs = 0 ;
1109- Dwarf_Signed count = 0 ;
1110- Dwarf_Signed i = 0 ;
1111- int fres = 0 ;
1112-
1113- fres = dwarf_get_funcs (dbg , & funcs ,& count , & error );
1114- if (fres == DW_DLV_OK ) {
1115- /* OBSOLETE: see dwarf_funcs_dealloc() above */
1116- for (i = 0 ; i < count ; ++ i ) {
1117- /* use funcs[i] */
1118- dwarf_dealloc (dbg , funcs [i ], DW_DLA_FUNC );
1119- }
1120- dwarf_dealloc (dbg , funcs , DW_DLA_LIST );
1121- }
1122- }
1123-
1124- void examplel (Dwarf_Debug dbg )
1118+ /*! @defgroup examplel Example of dwarf_get_types use
1119+ @code
1120+ */
1121+ int examplel (Dwarf_Debug dbg , Dwarf_Error * error )
11251122{
1126- Dwarf_Error error = 0 ;
11271123 Dwarf_Signed count = 0 ;
11281124 Dwarf_Type * types = 0 ;
11291125 Dwarf_Signed i = 0 ;
11301126 int res = 0 ;
11311127
1132- res = dwarf_get_types (dbg , & types ,& count , & error );
1133- if (res == DW_DLV_OK ) {
1134- for (i = 0 ; i < count ; ++ i ) {
1135- /* use types[i] */
1136- }
1137- dwarf_types_dealloc (dbg , types , count );
1128+ res = dwarf_get_types (dbg , & types ,& count , error );
1129+ if (res != DW_DLV_OK ) {
1130+ return res ;
11381131 }
1139- }
1140-
1141- void examplem (Dwarf_Debug dbg )
1142- {
1143- Dwarf_Error error = 0 ;
1144- Dwarf_Signed count = 0 ;
1145- Dwarf_Type * types = 0 ;
1146- Dwarf_Signed i = 0 ;
1147- int res = 0 ;
1148-
1149- /* OBSOLETE: see dwarf_types_dealloc() above */
1150- res = dwarf_get_types (dbg , & types ,& count , & error );
1151- if (res == DW_DLV_OK ) {
1152- for (i = 0 ; i < count ; ++ i ) {
1132+ for (i = 0 ; i < count ; ++ i ) {
11531133 /* use types[i] */
1154- dwarf_dealloc (dbg , types [i ], DW_DLA_TYPENAME );
1155- }
1156- dwarf_dealloc (dbg , types , DW_DLA_LIST );
11571134 }
1135+ dwarf_types_dealloc (dbg , types , count );
1136+ return DW_DLV_OK ;
11581137}
1138+ /*! @endcode */
11591139
1160- void examplen (Dwarf_Debug dbg )
1140+ int examplen (Dwarf_Debug dbg , Dwarf_Error * error )
11611141{
1162- Dwarf_Error error = 0 ;
11631142 Dwarf_Signed count = 0 ;
11641143 Dwarf_Var * vars = 0 ;
11651144 Dwarf_Signed i = 0 ;
11661145 int res = 0 ;
1167- res = dwarf_get_vars (dbg , & vars ,& count ,& error );
1168- if (res == DW_DLV_OK ) {
1169- for (i = 0 ; i < count ; ++ i ) {
1170- /* use vars[i] */
1171- }
1172- dwarf_vars_dealloc (dbg , vars , count );
1173- }
1174- }
11751146
1176- void exampleo (Dwarf_Debug dbg )
1177- {
1178- Dwarf_Error error = 0 ;
1179- Dwarf_Signed count = 0 ;
1180- Dwarf_Var * vars = 0 ;
1181- Dwarf_Signed i = 0 ;
1182- int res = 0 ;
1183- res = dwarf_get_vars (dbg , & vars ,& count ,& error );
1184- if (res == DW_DLV_OK ) {
1185- /* DO NOT USE: see dwarf_vars_dealloc() above */
1186- for (i = 0 ; i < count ; ++ i ) {
1187- /* use vars[i] */
1188- dwarf_dealloc (dbg , vars [i ], DW_DLA_VAR );
1189- }
1190- dwarf_dealloc (dbg , vars , DW_DLA_LIST );
1147+ res = dwarf_get_vars (dbg , & vars ,& count ,error );
1148+ if (res != DW_DLV_OK ) {
1149+ return res ;
1150+ }
1151+ for (i = 0 ; i < count ; ++ i ) {
1152+ /* use vars[i] */
11911153 }
1154+ dwarf_vars_dealloc (dbg , vars , count );
1155+ return DW_DLV_OK ;
11921156}
11931157
11941158void exampledebugnames ()
0 commit comments