Beispiel #1
0
static void destroy_parser_data(CTX_T *data) {
    linklst_destroy_all(data->motif_queue, destroy_motif);
    linklst_destroy_all(data->errors, free);
    if (data->fscope.background) {
        free_array(data->fscope.background);
    }
    if (data->motif) destroy_motif(data->motif);
    memset(data, 0, sizeof(CTX_T));
    free(data);
}
Beispiel #2
0
/*****************************************************************************
 * Destroys the data used by the SAX parser
 ****************************************************************************/
void destroy_dreme_io_xml_sax_context(void *ctx) {
  PS_T *ps = (PS_T*)ctx;
  if (ps->motif_id) free(ps->motif_id);
  free(ps->characters.buffer);
  linklst_destroy_all(ps->expected_stack, free);
  free(ps);
}
Beispiel #3
0
/*
 * jsonwr_close
 * Closes a JSON writer.
 */
void jsonwr_close(JSONWR_T* jsonwr) {
  unwind_stack(jsonwr);
  linklst_destroy_all(jsonwr->stack, free);
  str_destroy(jsonwr->value_buf, FALSE);
  str_destroy(jsonwr->line_buf, FALSE);
  memset(jsonwr, 0, sizeof(JSONWR_T));
  free(jsonwr);
}
Beispiel #4
0
/*****************************************************************************
 * Destroys the data used by the SAX parser
 ****************************************************************************/
void destroy_dreme_io_xml_sax_context(void *ctx) {
  PS_T *ps = (PS_T*)ctx;
  if (ps->motif_id) free(ps->motif_id);
  if (ps->freqs) free(ps->freqs);
  rbtree_destroy(ps->alph_ids);
  free(ps->characters.buffer);
  attrbuf_free(&(ps->attrbuf));
  linklst_destroy_all(ps->expected_stack, free);
  free(ps);
}
/*****************************************************************************
 * Destroy the parser along with any motifs which weren't retrieved.
 ****************************************************************************/
static void destroy_parser_data(CTX_T *data) {
  if (data->fscope.scanned_sites) {
    if (!(data->fscope.options_returned & SCANNED_SITES)) {
      arraylst_destroy(sseq_destroy, data->fscope.scanned_sites);
    }
  }
  if (data->fscope.background) {
    free_array(data->fscope.background);
  }
  if (data->fscope.release) {
    free(data->fscope.release);
  }
  if (data->sequence_lookup) rbtree_destroy(data->sequence_lookup);
  linklst_destroy_all(data->warnings, free);
  linklst_destroy_all(data->errors, free);
  linklst_destroy_all(data->motif_queue, destroy_motif);
  rbtree_destroy(data->letter_lookup);
  if (data->alph) alph_release(data->alph);
  if (data->alph_rdr) alph_reader_destroy(data->alph_rdr);
  memset(data, 0, sizeof(CTX_T));
  free(data);
}
Beispiel #6
0
/*
 * Destroys a linked list but does not free the items
 */
void linklst_destroy(LINKLST_T * linklst) {
  linklst_destroy_all(linklst, do_nothing);
}