source: tags/arb_5.1/CONVERTALN/convert.c

Last change on this file was 5829, checked in by westram, 16 years ago
  • included some patches for OSX (thx to Matt Cottrell)
  • added global switch LINK_STATIC
  • added script which checks for tools needed to compile ARB
  • typo CCPLIB→CPPLIB
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
1/* ================================================================ */
2/*                                                                  */
3/*   File      : convert.c                                          */
4/*   Purpose   : some helpers for global data handling              */
5/*                                                                  */
6/*   Coded by Ralf Westram (coder@reallysoft.de) in December 2006   */
7/*   Institute of Microbiology (Technical University Munich)        */
8/*   http://www.arb-home.de/                                        */
9/*                                                                  */
10/* ================================================================ */
11#include "convert.h"
12#include "global.h"
13
14struct global_data data; 
15
16int realloc_sequence_data(int total_seqs) {
17    if (total_seqs>data.allocated) {
18        data.allocated = (int)(data.allocated*1.5)+5;
19
20        data.ids     =(char**)Reallocspace((char *)data.ids,     sizeof(char*)*data.allocated);
21        data.seqs    =(char**)Reallocspace((char *)data.seqs,    sizeof(char*)*data.allocated);
22        data.lengths =(int*)  Reallocspace((char *)data.lengths, sizeof(int)  *data.allocated);
23
24        if (!data.ids || !data.seqs || !data.lengths) {
25            return 0; // failed
26        }
27    }
28    return 1; // success
29}
30
31void free_sequence_data(int used_entries) {
32    int indi;
33    for(indi=0; indi<used_entries; indi++)  {
34        Freespace(&(data.ids[indi]));
35        Freespace(&(data.seqs[indi]));
36    }
37    Freespace(&(data.ids));
38    Freespace(&(data.seqs));
39    Freespace(&(data.lengths));
40
41    data.allocated = 0;
42}
43
Note: See TracBrowser for help on using the repository browser.