Esempio n. 1
0
void CaptureFile::resetState() {
    /* Die if we're in the middle of reading a file. */
    //	g_assert(state != FILE_READ_IN_PROGRESS); //FIXME controllo?

    if (wth) {
        wtap_close(wth);
        wth = NULL;
    }


#if GLIB_CHECK_VERSION(2,10,0)
    if (plist != NULL)
        g_slice_free_chain(frame_data, plist, next);
#else
    if (plist_chunk != NULL) {
        frame_data *fdata = plist;
        while (fdata) {
            g_strfreev(fdata->col_expr.col_expr);
            g_strfreev(fdata->col_expr.col_expr_val);
            fdata = fdata->next;
        }
        /* memory chunks have been deprecated in favor of the slice allocator,
         * which has been added in 2.10
         */
        g_mem_chunk_destroy(plist_chunk);
        plist_chunk = NULL;
    }
#endif
    if (rfcode != NULL) {
        dfilter_free(rfcode);
        rfcode = NULL;
    }
    plist = NULL;
    plist_end = NULL;
    //	cf_unselect_packet(cf);	/* nothing to select */
    //    first_displayed = NULL;
    //    last_displayed = NULL;
    //
    //    /* No frame selected, no field in that frame selected. */
    //    current_frame = NULL;
    //    current_row = 0;
    //    finfo_selected = NULL;

    /* Clear the packet list. */
    //	packet_list_freeze();
    //	packet_list_clear();
    //	packet_list_thaw();

    f_datalen = 0;
    count = 0;
    //nstime_set_zero(&elapsed_time);

    //  reset_tap_listeners();

    /* We have no file open. */
    state = FILE_CLOSED;

    //fileset_file_closed();
}
Esempio n. 2
0
static void
simple_entry_free (Entry *entry)
{
  /* release all lentries */
  g_slice_free_chain (LEntry, entry->lfirst, next);

  /* release the entry */
  g_slice_free (Entry, entry);
}
/**
 * gst_sparse_file_free:
 * @file: a #GstSparseFile
 *
 * Free the memory used by @file.
 *
 * Since: 1.4
 */
void
gst_sparse_file_free (GstSparseFile * file)
{
  g_return_if_fail (file != NULL);

  if (file->file) {
    fflush (file->file);
    fclose (file->file);
  }
  g_slice_free_chain (GstSparseRange, file->ranges, next);
  g_slice_free (GstSparseFile, file);
}
Esempio n. 4
0
File: slice.c Progetto: Babelz/SaNi
static void
test_chain (void)
{
  TestStruct *ts, *head;

  head = ts = g_slice_new (TestStruct);
  ts->next = g_slice_new (TestStruct);
  ts = ts->next;
  ts->next = g_slice_new (TestStruct);
  ts = ts->next;
  ts->next = NULL;

  g_slice_free_chain (TestStruct, head, next);
}
/**
 * gst_sparse_file_clear:
 * @file: a #GstSparseFile
 *
 * Clear all the ranges in @file.
 */
void
gst_sparse_file_clear (GstSparseFile * file)
{
  g_return_if_fail (file != NULL);

  if (file->file) {
    fclose (file->file);
    file->file = fdopen (file->fd, "wb+");
  }
  g_slice_free_chain (GstSparseRange, file->ranges, next);
  file->current_pos = 0;
  file->ranges = NULL;
  file->n_ranges = 0;
}
Esempio n. 6
0
/**
 * g_slist_free:
 * @list: a #GSList
 *
 * Frees all of the memory used by a #GSList.
 * The freed elements are returned to the slice allocator.
 */
void
g_slist_free (GSList *list)
{
  g_slice_free_chain (GSList, list, next);
}
Esempio n. 7
0
void
osync_list_free (OSyncList *list)
{
	osync_return_if_fail(list);
	g_slice_free_chain (OSyncList, list, next);
}