[Julius-cvs 600] CVS update: julius4/libsent/src/voca

アーカイブの一覧に戻る

sumom****@users***** sumom****@users*****
2011年 2月 11日 (金) 00:23:52 JST


Index: julius4/libsent/src/voca/voca_load_htkdict.c
diff -u julius4/libsent/src/voca/voca_load_htkdict.c:1.8 julius4/libsent/src/voca/voca_load_htkdict.c:1.9
--- julius4/libsent/src/voca/voca_load_htkdict.c:1.8	Sat Feb  5 18:00:41 2011
+++ julius4/libsent/src/voca/voca_load_htkdict.c	Fri Feb 11 00:23:52 2011
@@ -19,7 +19,7 @@
  * @author Akinobu LEE
  * @date   Fri Feb 18 19:43:06 2005
  *
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
  * 
  */
 /*
@@ -375,8 +375,7 @@
 {
   char *ptmp, *lp = NULL, *p;
   static char cbuf[MAX_HMMNAME_LEN];
-  static HMM_Logical **tmpwseq = NULL;
-  static int tmpmaxlen;
+  HMM_Logical **tmpwseq;
   int len;
   HMM_Logical *tmplg;
   boolean pok;
@@ -387,10 +386,11 @@
   if (strmatch(buf, "DICEND")) return FALSE;
 
   /* allocate temporal work area for the first call */
-  if (tmpwseq == NULL) {
-    tmpmaxlen = PHONEMELEN_STEP;
-    tmpwseq = (HMM_Logical **)mymalloc(sizeof(HMM_Logical *) * tmpmaxlen);
+  if (winfo->work == NULL) {
+    winfo->work_num = PHONEMELEN_STEP;
+    winfo->work = (void *)mybmalloc2(sizeof(HMM_Logical *) * winfo->work_num, &(winfo->mroot));
   }
+  tmpwseq = (HMM_Logical **)winfo->work;
 
   /* backup whole line for debug output */
   strcpy(bufbak, buf);
@@ -551,10 +551,12 @@
 	pok = FALSE;
       } else {
 	/* found */
-	if (len >= tmpmaxlen) {
+	if (len >= winfo->work_num) {
 	  /* expand wseq area by PHONEMELEN_STEP */
-	  tmpmaxlen += PHONEMELEN_STEP;
-	  tmpwseq = (HMM_Logical **)myrealloc(tmpwseq, sizeof(HMM_Logical *) * tmpmaxlen);
+	  winfo->work_num += PHONEMELEN_STEP;
+	  winfo->work = (void *)mybmalloc2(sizeof(HMM_Logical *) * winfo->work_num, &(winfo->mroot));
+	  memcpy(winfo->work, tmpwseq, sizeof(HMM_Logical *) * (winfo->work_num - PHONEMELEN_STEP));
+	  tmpwseq = (HMM_Logical **)winfo->work;
 	}
 	/* store to temporal buffer */
 	tmpwseq[len] = tmplg;
Index: julius4/libsent/src/voca/voca_malloc.c
diff -u julius4/libsent/src/voca/voca_malloc.c:1.2 julius4/libsent/src/voca/voca_malloc.c:1.3
--- julius4/libsent/src/voca/voca_malloc.c:1.2	Tue Dec 18 17:45:54 2007
+++ julius4/libsent/src/voca/voca_malloc.c	Fri Feb 11 00:23:52 2011
@@ -12,7 +12,7 @@
  * @author Akinobu LEE
  * @date   Fri Feb 18 21:33:29 2005
  *
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
  * 
  */
 /*
@@ -38,6 +38,7 @@
 
   new = (WORD_INFO *)mymalloc(sizeof(WORD_INFO));
   new->mroot = NULL;
+  new->work = NULL;
 
   return(new);
 }



Julius-cvs メーリングリストの案内
アーカイブの一覧に戻る