Changeset 711 for trunk/gsdl/src/mgpp/text/backend.cpp
- Timestamp:
- 1999-10-18T12:43:31+13:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/mgpp/text/backend.cpp
r655 r711 283 283 if (textname == NULL) textname = name; /* [RJM 06/97: text filename] */ 284 284 285 if (!(qd = (query_data *) Xmalloc (sizeof (query_data))))285 if (!(qd = new query_data)) 286 286 { 287 287 abort(0); … … 326 326 { 327 327 /* [RJM 06/97: text filename] */ 328 if (!(qd->pathname = (char *) Xmalloc (strlen (dir) + strlen (name) + 1)) ||329 !(qd->textpathname = (char *) Xmalloc (strlen (dir) + strlen (textname) + 1)))328 if (!(qd->pathname = new char[strlen (dir) + strlen (name) + 1]) || 329 !(qd->textpathname = new char[strlen (dir) + strlen (textname) + 1])) 330 330 { 331 331 abort(1); … … 338 338 { 339 339 /* [RJM 06/97: text filename] */ 340 if (!(qd->pathname = (char *) Xmalloc (strlen (dir) + strlen (name) + 2)) ||341 !(qd->textpathname = (char *) Xmalloc (strlen (dir) + strlen (textname) + 2)))340 if (!(qd->pathname = new char[strlen (dir) + strlen (name) + 2]) || 341 !(qd->textpathname = new char[strlen (dir) + strlen (textname) + 2])) 342 342 { 343 343 abort(1); … … 509 509 510 510 fread((void *)&magic, sizeof(magic), 1, paragraph); 511 qd->paragraph = Xmalloc((qd->td->cth.num_of_docs+1)*sizeof(int));511 qd->paragraph = new int[qd->td->cth.num_of_docs+1]; 512 512 qd->paragraph[0] = 0; 513 513 for (i = 1; i <= qd->td->cth.num_of_docs; i++) … … 545 545 size = ftell (f); 546 546 fseek (f, 0, 0); 547 trec_ids = Xmalloc (size);547 trec_ids = new char[size]; 548 548 if (!trec_ids) 549 549 { … … 557 557 int i, d; 558 558 unsigned long magic; 559 trec_paras = Xmalloc (qd->sd->sdh.num_of_docs * sizeof (long));559 trec_paras = new long[qd->sd->sdh.num_of_docs]; 560 560 if (!trec_paras) 561 561 { 562 Xfree (trec_ids);562 delete trec_ids; 563 563 trec_ids = NULL; 564 564 goto error; … … 595 595 error: 596 596 if (trec_ids) 597 Xfree (trec_ids);597 delete trec_ids; 598 598 if (trec_paras) 599 Xfree (trec_paras);599 delete (trec_paras); 600 600 trec_ids = NULL; 601 601 trec_paras = NULL; … … 629 629 close_all_files (qd); 630 630 case 2: 631 Xfree (qd->textpathname); /* [RJM 06/97: text filename] */631 delete (qd->textpathname); /* [RJM 06/97: text filename] */ 632 632 case 1: 633 633 if (qd->pathname) 634 Xfree (qd->pathname); /* [RJM 06/97: text filename] */635 Xfree (qd);634 delete (qd->pathname); /* [RJM 06/97: text filename] */ 635 delete qd; 636 636 break; 637 637 } … … 679 679 #if defined(PARADOCNUM) || defined(NZDL) 680 680 if (qd->paragraph != NULL) { 681 Xfree (qd->paragraph);681 delete (qd->paragraph); 682 682 qd->paragraph = NULL; 683 683 } … … 696 696 FreeStemDict (qd->sd); 697 697 close_all_files (qd); 698 Xfree (qd->textpathname); /* [RJM 06/97: text filename] */699 Xfree (qd->pathname);698 delete (qd->textpathname); /* [RJM 06/97: text filename] */ 699 delete (qd->pathname); 700 700 QueryData_FreeQueryDocs (qd); 701 701 if (qd->TL != NULL) TermList_destroy(&qd->TL); /* [RJM 07/98: Memory Leak] */ 702 702 if (qd->QTL != NULL) QueryTermList_free(&qd->QTL); /* [RJM 07/98: Memory Leak] */ 703 Xfree (qd);703 delete qd; 704 704 705 705 /* other global stuff hanging around */ … … 777 777 if (qd->TextBuffer) 778 778 { 779 Xfree (qd->TextBuffer);779 delete qd->TextBuffer; 780 780 ChangeMemInUse (qd, -qd->TextBufferLen); 781 781 } … … 799 799 if (qd->DL->DE[i].CompTextBuffer) 800 800 { 801 Xfree (qd->DL->DE[i].CompTextBuffer);801 delete qd->DL->DE[i].CompTextBuffer; 802 802 qd->DL->DE[i].CompTextBuffer = NULL; 803 803 ChangeMemInUse (qd, -qd->DL->DE[i].Len); … … 903 903 qd->TextBufferLen = (int) (qd->td->cth.ratio * 1.01 * 904 904 DocEntry_length(DE)) + 100; 905 if (!(qd->TextBuffer = (unsigned char *) Xmalloc (qd->TextBufferLen)))905 if (!(qd->TextBuffer = new unsigned char[qd->TextBufferLen])) 906 906 { 907 907 fprintf (stderr, "No memory for TextBuffer\n");
Note:
See TracChangeset
for help on using the changeset viewer.