summarylogtreecommitdiffstats
path: root/0005-remove-all-the-remaining-unnecessary-stuff.patch
blob: a1f478b6b92be4b9caf96dc734070cf0c3449913 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
From e54e50a1f35b5636d92baef536d78fd844267ca2 Mon Sep 17 00:00:00 2001
From: Ronny Lorenz <ronny@tbi.univie.ac.at>
Date: Tue, 28 Jan 2014 16:57:04 +0100
Subject: [PATCH 5/8] remove all the remaining unnecessary stuff

---
 Node.cpp |  7 ++++---
 Util.cpp | 27 +--------------------------
 2 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/Node.cpp b/Node.cpp
index 3ddcb0f..3f33123 100644
--- a/Node.cpp
+++ b/Node.cpp
@@ -291,12 +291,13 @@ void Node::CalculateFoldingPath(Node* extremum,std::string integrated_structure)
       int maxE_idx = -1;
       int t = Node::transcribed;
       std::vector<std::pair<double,std::string> > v;
-
+      /* length of path always is the base pair distance + 1 */
+      p_len = bp_distance(const_cast<char*>(sequence.substr(0,t).c_str()),
+                          const_cast<char*>(Node::front_structure.c_str())) + 1;
       p = get_path(const_cast<char*>(sequence.substr(0,t).c_str()),
 		   const_cast<char*>(Node::front_structure.c_str()),
 		   const_cast<char*>(integrated_structure.substr(0,t).c_str()),
-		   Node::OptS->maxkeep,
-		   &p_len);
+		   Node::OptS->maxkeep);
       bool barrier_exceeded=false;
       for (int i=0; i<p_len; i++) {
 	// memorize idx of structure with highest energy seen so far
diff --git a/Util.cpp b/Util.cpp
index d0a9ecb..592a303 100644
--- a/Util.cpp
+++ b/Util.cpp
@@ -57,16 +57,6 @@ std::string PrintPairTable(){
   return s;
 }
 
-void
-PrettyPrint(char *fmt, ...)
-{
-  va_list args;
-
-  va_start(args, fmt);
-  vfprintf(stdout, fmt, args);
-  fflush(stdout);
-  va_end(args);  
-}
 
 std::string PrintBasePair(std::pair<int,int> bp){
   return "("+Str(bp.first)+","+Str(bp.second)+")";
@@ -283,21 +273,6 @@ ConformationToStacks(std::vector<std::vector<std::pair<int,int> > > & stacks, st
   }
 }
 
-void *MG_space(unsigned size) {
-  void *pointer;
-  
-  if ( (pointer = (void *) calloc(1, (size_t) size)) == NULL) {
-#ifdef EINVAL
-    if (errno==EINVAL) {
-      fprintf(stderr,"SPACE: requested size: %d\n", size);
-       printf("SPACE allocation failure -> EINVAL");
-    }
-    if (errno==ENOMEM)
-#endif
-      printf("SPACE allocation failure -> no memory");
-  }
-  return  pointer;
-}
 
 #ifdef WITH_DMALLOC
 #define MG_space(S) calloc(1,(S))
@@ -314,7 +289,7 @@ void *MG_space(unsigned size) {
    //   short *table;
    
    length = (short) strlen(structure);
-   stack = (short *) MG_space(sizeof(short)*(length+1));
+   stack = (short *) space(sizeof(short)*(length+1));
    //table = (short *) space(sizeof(short)*(length+2));
    pair_table[0] = length;
    
-- 
2.5.2