Changeset 32339
- Timestamp:
- Sep 6, 2011, 11:02:30 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110710/psLib/src
- Files:
-
- 6 edited
- 2 copied
-
fits/Makefile.am (modified) (2 diffs)
-
fits/psFitsTableNew.c (copied) (copied from trunk/psLib/src/fits/psFitsTableNew.c )
-
fits/psFitsTableNew.h (copied) (copied from trunk/psLib/src/fits/psFitsTableNew.h )
-
pslib_strict.h (modified) (1 diff)
-
sys/psMemory.c (modified) (5 diffs)
-
sys/psMemory.h (modified) (2 diffs)
-
types/psMetadataConfig.c (modified) (5 diffs)
-
types/psMetadataConfig.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110710/psLib/src/fits/Makefile.am
r16185 r32339 9 9 psFitsImage.c \ 10 10 psFitsTable.c \ 11 psFitsTableNew.c \ 11 12 psFitsFloat.c \ 12 13 psFitsFloatFile.c \ … … 20 21 psFitsImage.h \ 21 22 psFitsTable.h \ 23 psFitsTableNew.h \ 22 24 psFitsFloat.h \ 23 25 psFitsFloatFile.h \ -
branches/eam_branches/ipp-20110710/psLib/src/pslib_strict.h
r27303 r32339 41 41 #include "psFitsImage.h" 42 42 #include "psFitsTable.h" 43 #include "psFitsTableNew.h" 43 44 #include "psFitsFloat.h" 44 45 #include "psFitsFloatFile.h" -
branches/eam_branches/ipp-20110710/psLib/src/sys/psMemory.c
r31660 r32339 515 515 continue; 516 516 } 517 if (memBlock->nextBlock && memBlock->nextBlock->inFlight) { 518 // nope, we need to try again 519 MUTEX_UNLOCK(&memBlockListMutex); 520 usleep (BLOCK_SLEEP); 521 retryLock ++; 522 continue; 523 } 524 if (memBlock->previousBlock && memBlock->previousBlock->inFlight) { 525 // nope, we need to try again 526 MUTEX_UNLOCK(&memBlockListMutex); 527 usleep (BLOCK_SLEEP); 528 retryLock ++; 529 continue; 530 } 517 if (memBlock->nextBlock && memBlock->nextBlock->inFlight) { 518 // we reply on the value of 'inFlight'. we should crash if this block is corrupted 519 if (memBlock->nextBlock->startblock != P_PS_MEMMAGIC) { 520 PS_MEM_ABORT(__func__, "Unsafe to Continue\n"); 521 } 522 if (memBlock->nextBlock->endblock != P_PS_MEMMAGIC) { 523 PS_MEM_ABORT(__func__, "Unsafe to Continue\n"); 524 } 525 // nope, we need to try again 526 MUTEX_UNLOCK(&memBlockListMutex); 527 usleep (BLOCK_SLEEP); 528 retryLock ++; 529 continue; 530 } 531 if (memBlock->previousBlock && memBlock->previousBlock->inFlight) { 532 // we reply on the value of 'inFlight'. we should crash if this block is corrupted 533 if (memBlock->previousBlock->startblock != P_PS_MEMMAGIC) { 534 PS_MEM_ABORT(__func__, "Unsafe to Continue\n"); 535 } 536 if (memBlock->previousBlock->endblock != P_PS_MEMMAGIC) { 537 PS_MEM_ABORT(__func__, "Unsafe to Continue\n"); 538 } 539 // nope, we need to try again 540 MUTEX_UNLOCK(&memBlockListMutex); 541 usleep (BLOCK_SLEEP); 542 retryLock ++; 543 continue; 544 } 531 545 532 546 // the markers are ours! … … 889 903 psMemBlock ***array, 890 904 FILE * fd, 891 bool persistence) 905 bool persistence, 906 int maxDisplayedLeaksCount ///< List at most maxDisplayedLeaksCount (-1 for all) 907 ) 892 908 { 893 909 psS32 nleak = 0; … … 896 912 897 913 // XXX move this elsewhere? 898 fprintf (stderr, "set %d locks, cleared %d locks, retry on %d locks (memID %ld)\n", setLock, clearLock, retryLock, memid); 914 if (fd != NULL) { 915 fprintf (fd, "set %d locks, cleared %d locks, retry on %d locks (memID %ld)\n", setLock, clearLock, retryLock, memid); 916 } 899 917 900 918 // make sure that the memblock list is free of corruption before we crawl … … 915 933 for (memBlock = topBlock; memBlock->nextBlock != NULL; memBlock = memBlock->nextBlock) { } 916 934 935 int maxToDisplay = maxDisplayedLeaksCount; 936 psMemBlock *memBlockBackup = memBlock; 937 if (maxToDisplay == -1 ) { 938 for (; memBlock != NULL; memBlock = memBlock->previousBlock) { 939 if ( (memBlock->refCounter > 0) && 940 ( (persistence) || (!persistence && !memBlock->persistent) ) && 941 (memBlock->id >= id0)) { 942 nleak++; 943 } 944 } 945 maxToDisplay=nleak; 946 } 947 if (fd != NULL) { 948 fprintf(fd, "Number of leaks to display: %d\n", maxToDisplay); 949 } 950 memBlock = memBlockBackup; 951 952 nleak=0; 917 953 // iterate through the block list starting with the oldest block 918 954 for (; memBlock != NULL; memBlock = memBlock->previousBlock) { … … 924 960 925 961 // only print a max of 500 leaks (make this an argument) 926 if ( (nleak < 500) && (fd != NULL)) {962 if ( (nleak <= maxToDisplay) && (fd != NULL) ) { 927 963 if (nleak == 1) { 928 964 fprintf(fd, "# func at (file:line) ID: X Ref: X\n"); -
branches/eam_branches/ipp-20110710/psLib/src/sys/psMemory.h
r31660 r32339 367 367 bool persistence ///< make check across all object even persistent ones 368 368 ); 369 int psMemCheckLeaks2( 370 psMemId id0, ///< don't list blocks with id < id0 371 psMemBlock ***array, ///< pointer to array of pointers to leaked blocks, or NULL 372 FILE * fd, ///< print list of leaks to fd (or NULL) 373 bool persistence, ///< make check across all object even persistent ones 374 int maxDisplayedLeaksCount ///< List at most maxDisplayedLeaksCount (-1 for all) 375 ); 369 376 #else // ifdef DOXYGEN 370 377 int p_psMemCheckLeaks( … … 375 382 psMemBlock ***array, ///< pointer to array of pointers to leaked blocks, or NULL 376 383 FILE * fd, ///< print list of leaks to fd (or NULL) 377 bool persistence ///< make check across all object even persistent ones 378 ); 379 #ifndef SWIG 384 bool persistence, ///< make check across all object even persistent ones 385 int maxDisplayedLeaksCount ///< List at most maxDisplayedLeaksCount (-1 for all) 386 ); 387 #ifndef SWIG 388 #define psMemCheckLeaks2(id0, array, fd, persistence, maxDisplayedLeaksCount) \ 389 p_psMemCheckLeaks(__FILE__, __LINE__, __func__, id0, array, fd, persistence, maxDisplayedLeaksCount) 380 390 #define psMemCheckLeaks(id0, array, fd, persistence) \ 381 p_psMemCheckLeaks(__FILE__, __LINE__, __func__, id0, array, fd, persistence )391 p_psMemCheckLeaks(__FILE__, __LINE__, __func__, id0, array, fd, persistence, 500) 382 392 #endif // ifndef SWIG 383 393 #endif // ifdef DOXYGEN -
branches/eam_branches/ipp-20110710/psLib/src/types/psMetadataConfig.c
r29934 r32339 72 72 static bool parseMetadataItem(char *keyName, psArray *levelArray, 73 73 char *linePtr, psMetadataFlags flags); 74 static psString formatMetadataItem(psMetadataItem *item);75 74 static psArray *p_psMetadataKeyArray(psMetadata *md); 76 75 static bool parseGeneric(char *keyName, … … 1337 1336 return NULL; 1338 1337 } 1339 psString str = formatMetadataItem(item);1338 psString str = psMetadataItemFormat(item); 1340 1339 if (!str) { 1341 1340 psError(PS_ERR_UNKNOWN, false, "failed to format psMetadataItem"); … … 1355 1354 } 1356 1355 1357 1358 static psString formatMetadataItem(psMetadataItem *item)1356 // format a single metadata item for output (consistent with config dump I/O, includes return char) 1357 psString psMetadataItemFormat(psMetadataItem *item) 1359 1358 { 1360 1359 PS_ASSERT_METADATA_ITEM_NON_NULL(item, NULL); … … 1380 1379 psMetadataItem *multiItem = NULL; 1381 1380 while ((multiItem = psListGetAndIncrement(iter))) { 1382 psString str = formatMetadataItem(multiItem);1381 psString str = psMetadataItemFormat(multiItem); 1383 1382 psStringAppend(&content, "%s", str); 1384 1383 psFree(str); … … 1597 1596 } 1598 1597 1599 1600 1598 static psArray *p_psMetadataKeyArray(psMetadata *md) 1601 1599 { -
branches/eam_branches/ipp-20110710/psLib/src/types/psMetadataConfig.h
r29934 r32339 79 79 ); 80 80 81 /** format metadata item. 82 * 83 * Metadata Item is formatted to a string consistent with the MDC file formats 84 * 85 * @return char: allocated formatted string 86 */ 87 psString psMetadataItemFormat(psMetadataItem *item); 88 81 89 /** Converts a psMetadata structure (including any nested psMetadata) into a 82 90 * configuration file formatted string that is written out to filename.
Note:
See TracChangeset
for help on using the changeset viewer.
