void insert_context_header (FILE *fp, Accessible *accessible) { char *name; char *label; char *object_record; int size; char *accessible_name; OBJECT_INFO *cur_obj_info = NULL; cur_obj_info = get_object_info (accessible); accessible_name = Accessible_getName (accessible); label = g_strdup (accessible_name); SPI_freeString (accessible_name); if (strcmp (label, "") != 0) { char *stripped_data = NULL; char *tmp_data = NULL; if (strchr (label, ' ')) stripped_data = strip_white_space (label); else stripped_data = g_strdup (label); if (strchr (stripped_data, '.')) tmp_data = strip_delim (stripped_data, '.'); else tmp_data = g_strdup (stripped_data); name = g_strdup_printf ("%s%s", cur_obj_info->prefix, tmp_data); g_free (tmp_data); g_free (stripped_data); g_free (label); g_free (cur_obj_info->object_type); g_free (cur_obj_info->prefix); g_free (cur_obj_info); } else { /* * TODO: Handle the case of window label being NULL */ g_print ("Found window with label value as NULL!!"); g_free (label); g_free (object_record); g_free (cur_obj_info->object_type); g_free (cur_obj_info->prefix); g_free (cur_obj_info); } object_record = g_strdup_printf ("[%s]\n", name); size = strlen (object_record); fwrite (object_record, sizeof (char), size, fp); g_free (name); g_free (object_record); }