Get rid of Trim().

Change-Id: I535347c72e5bf29ad3f20f44b74b90880813c336
Prog::Flatten() does the same thing when it finishes.
Reviewed-on: https://code-review.googlesource.com/4761
Reviewed-by: Paul Wankadia <[email protected]>
diff --git a/re2/compile.cc b/re2/compile.cc
index 334ee4c..5faf7f6 100644
--- a/re2/compile.cc
+++ b/re2/compile.cc
@@ -178,9 +178,6 @@
   // Returns -1 if no more instructions are available.
   int AllocInst(int n);
 
-  // Deletes unused instructions.
-  void Trim();
-
   // Rune range compiler.
 
   // Begins a new alternation.
@@ -291,16 +288,6 @@
   return id;
 }
 
-void Compiler::Trim() {
-  if (inst_len_ < inst_cap_) {
-    Prog::Inst* ip = new Prog::Inst[inst_len_];
-    memmove(ip, inst_, inst_len_ * sizeof ip[0]);
-    delete[] inst_;
-    inst_ = ip;
-    inst_cap_ = inst_len_;
-  }
-}
-
 // These routines are somewhat hard to visualize in text --
 // see http://swtch.com/~rsc/regexp/regexp1.html for
 // pictures explaining what is going on here.
@@ -1223,8 +1210,7 @@
     inst_len_ = 1;
   }
 
-  // Trim instruction to minimum array and transfer to Prog.
-  Trim();
+  // Hand off the array to Prog.
   prog_->inst_ = inst_;
   prog_->size_ = inst_len_;
   inst_ = NULL;