Changeset 7847
- Timestamp:
- Jul 7, 2006, 5:17:13 PM (20 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 2 edited
-
sys/psLine.h (modified) (1 diff)
-
types/psMetadataConfig.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psLine.h
r7380 r7847 7 7 #define PS_LINE_H 8 8 9 / / structure to carry a dynamic string9 /** Structure to carry a dynamic string */ 10 10 typedef struct 11 11 { 12 long NLINE; //allocated length13 long Nline; //current length14 char *line; //character string data12 long NLINE; ///< allocated length 13 long Nline; ///< current length 14 char *line; ///< character string data 15 15 } 16 16 psLine; 17 17 18 // allocate a line object of length Nline 19 psLine *psLineAlloc(long Nline); 18 /** Allocates a line object of length Nline 19 * 20 * @return psLine*: the newly allocated line object. 21 */ 22 psLine *psLineAlloc( 23 long Nline ///< 24 ); 20 25 21 // (re-)init the line 22 bool psLineInit(psLine *line); 26 /** Initializes or re-initializes a line. 27 * 28 * Initializes or re-initializes a line, setting the current length to zero and setting 29 * the string data values to 0. If the function is passed NULL, false is returned. 30 * 31 * @return bool: True if successful, otherwise false. 32 */ 33 bool psLineInit( 34 psLine *line ///< 35 ); 23 36 24 // add the new string segment to the line 25 bool psLineAdd(psLine *line, const char *format, ...); 37 /** Adds the line segment to the string. 38 * 39 * Appends a line segment to the string, returning false if the new segment would 40 * overflow the allocated string length. 41 * 42 * @return bool: True if successful, otherwise false. 43 */ 44 bool psLineAdd( 45 psLine *line, ///< the line segment to append 46 const char *format, ///< printf-style format of line 47 ... ///< any parameters required in format 48 ); 26 49 27 50 #endif /* PS_LINE_H */ -
trunk/psLib/src/types/psMetadataConfig.c
r7832 r7847 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.6 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-07-0 7 02:25:54$12 * @version $Revision: 1.64 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-07-08 03:17:13 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 616 616 items = template->list->n; 617 617 if(items > 0 ) { 618 619 618 // Allocate metadata 620 619 md = psMetadataAlloc() 621 620 ; 622 623 621 // Point to first item in template 624 622 iter = psListIteratorAlloc(template-> 625 623 list,PS_LIST_HEAD,true); 626 627 624 // For each item in template parse line string for values 628 625 for(psS32 i = 0; 629 626 i < items; 630 627 i++) { 631 632 628 // Get template item 633 629 templateItem = psListGetAndIncrement(iter) … … 635 631 if(templateItem == NULL) { 636 632 psFree(md); 633 psFree(iter); 637 634 md = NULL; 638 635 break; 639 636 } 640 641 637 // Get the next token on the line 642 638 token = getToken(&linePtr," ",&status,false); … … 648 644 md = NULL; 649 645 psFree(token); 646 psFree(iter); 650 647 break; 651 648 } … … 656 653 psFree(mdItem); 657 654 psFree(token); 655 psFree(iter); 658 656 break; 659 657 } … … 662 660 // Missing items 663 661 psFree(md); 662 psFree(iter); 664 663 md = NULL; 665 664 break; … … 668 667 psFree(token); 669 668 } 670 psFree(iter);669 // psFree(iter); 671 670 } 672 671 return md; … … 1506 1505 psFree(keys); 1507 1506 psFree(format); 1507 psFree(str); 1508 1508 return NULL; 1509 1509 } … … 1542 1542 psFree(str); 1543 1543 } 1544 psFree(iter); 1544 1545 } 1545 1546 break; … … 1804 1805 } 1805 1806 } 1806 psArrayAdd(keys, 0, psStringCopy(item->name)); 1807 } 1808 1807 psString string = psStringCopy(item->name); 1808 psArrayAdd(keys, 0, string); 1809 psFree(string); 1810 } 1811 psFree(iter); 1809 1812 return keys; 1810 1813 }
Note:
See TracChangeset
for help on using the changeset viewer.
