@@ -68,10 +68,10 @@ void print_structure_rec(struct_db_rec_t *struct_rec) {
68
68
void print_structure_db (struct_db_t * struct_db ) {
69
69
if (!struct_db ) return ;
70
70
71
- printf ("Printing Structure Database" );
71
+ printf ("\n" ANSI_COLOR_RED " Printing Structure Database" ANSI_COLOR_RESET );
72
72
struct_db_rec_t * struct_rec = NULL ;
73
73
struct_rec = struct_db -> head ;
74
- printf ("No of Structures Registered = %d\n" , struct_db -> count );
74
+ printf ("\nNo of Structures Registered = %d\n" , struct_db -> count );
75
75
int i = 0 ;
76
76
while (struct_rec ) {
77
77
printf ("structure no : %d (%p)\n" , i ++ , struct_rec );
@@ -110,7 +110,7 @@ static struct_db_rec_t
110
110
111
111
static object_db_rec_t
112
112
* object_db_look_up (object_db_t * object_db , void * ptr ) {
113
- object_db_rec_t * head = object -> head ;
113
+ object_db_rec_t * head = object_db -> head ;
114
114
if (!head ) return NULL ;
115
115
for (; head ; head = head -> next ) {
116
116
if (head -> ptr == ptr )
@@ -142,7 +142,6 @@ static void add_object_to_object_db(object_db_t *object_db,
142
142
143
143
if (!head ) {
144
144
object_db -> head = obj_rec ;
145
- object -> next = NULL ;
146
145
object_db -> count ++ ;
147
146
return ;
148
147
}
@@ -156,23 +155,23 @@ void *xcalloc(object_db_t *object_db, char *struct_name, int uints) {
156
155
assert (struct_rec );
157
156
158
157
void * ptr = calloc (uints , struct_rec -> ds_size );
159
- add_object_to_object_db (object_db , ptr , uints , strutc_rec , MLD_FALSE );
158
+ add_object_to_object_db (object_db , ptr , uints , struct_rec , MLD_FALSE );
160
159
return ptr ;
161
160
}
162
161
163
162
/* Print functions for object database */
164
163
void print_object_rec (object_db_rec_t * obj_rec , int i ) {
165
164
if (!obj_rec ) return ;
166
- printf (ANSI_COLOR_MAGENTA "--------------------------|\n" ANSI_COLOR_RESET );
165
+ printf (ANSI_COLOR_MAGENTA "------------------------------------------------------------------------------------------------------------- |\n" ANSI_COLOR_RESET );
167
166
printf (ANSI_COLOR_YELLOW "%-3d ptr = %-10p | next = %-10p | units = %-4d | struct_name = %-10s | is_root = %s |\n" ANSI_COLOR_RESET , i , obj_rec -> ptr , obj_rec -> next , obj_rec -> units , obj_rec -> struct_rec -> struct_name , obj_rec -> is_root ? "TRUE" : "FALSE" );
168
- printf (ANSI_COLOR_MAGENTA "--------------------------|\n" ANSI_COLOR_RESET );
167
+ printf (ANSI_COLOR_MAGENTA "------------------------------------------------------------------------------------------------------------- |\n" ANSI_COLOR_RESET );
169
168
}
170
169
171
170
void print_object_db (object_db_t * object_db ) {
172
171
object_db_rec_t * head = object_db -> head ;
173
172
unsigned int i = 0 ;
174
- printf (ANSI_COLOR_CYAN "Printing OBJECT DATABASE\n" );
175
- for (; head ; head -> next ) {
173
+ printf ("\n" ANSI_COLOR_CYAN "PRINTING OBJECT DATABASE\n" ANSI_COLOR_RESET );
174
+ for (; head ; head = head -> next ) {
176
175
print_object_rec (head , i ++ );
177
176
}
178
177
}
0 commit comments