Changeset 453
- Timestamp:
- 10/25/09 11:36:48 (4 weeks ago)
- Location:
- ImageMagick/trunk
- Files:
-
- 26 modified
-
coders/png.c (modified) (12 diffs)
-
coders/tiff.c (modified) (3 diffs)
-
magick/cache.c (modified) (10 diffs)
-
magick/coder.c (modified) (8 diffs)
-
magick/color.c (modified) (11 diffs)
-
magick/configure.c (modified) (10 diffs)
-
magick/constitute.c (modified) (8 diffs)
-
magick/delegate.c (modified) (10 diffs)
-
magick/deprecate.c (modified) (1 diff)
-
magick/exception.c (modified) (9 diffs)
-
magick/gem.c (modified) (1 diff)
-
magick/image.c (modified) (2 diffs)
-
magick/locale.c (modified) (8 diffs)
-
magick/log.c (modified) (19 diffs)
-
magick/magic.c (modified) (10 diffs)
-
magick/magick.c (modified) (19 diffs)
-
magick/memory.c (modified) (9 diffs)
-
magick/mime.c (modified) (10 diffs)
-
magick/module.c (modified) (9 diffs)
-
magick/policy.c (modified) (12 diffs)
-
magick/random.c (modified) (3 diffs)
-
magick/registry.c (modified) (5 diffs)
-
magick/resource.c (modified) (15 diffs)
-
magick/semaphore.c (modified) (1 diff)
-
magick/type.c (modified) (12 diffs)
-
wand/wand.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ImageMagick/trunk/coders/png.c
r391 r453 1704 1704 1705 1705 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 1706 AcquireSemaphoreInfo(&png_semaphore);1706 LockSemaphoreInfo(png_semaphore); 1707 1707 #endif 1708 1708 … … 1749 1749 png_destroy_read_struct(&ping,&ping_info,&end_info); 1750 1750 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 1751 RelinquishSemaphoreInfo(png_semaphore);1751 UnlockSemaphoreInfo(png_semaphore); 1752 1752 #endif 1753 1753 if (logging != MagickFalse) … … 2249 2249 png_destroy_read_struct(&ping,&ping_info,&end_info); 2250 2250 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 2251 RelinquishSemaphoreInfo(png_semaphore);2251 UnlockSemaphoreInfo(png_semaphore); 2252 2252 #endif 2253 2253 if (logging != MagickFalse) … … 2280 2280 png_destroy_read_struct(&ping,&ping_info,&end_info); 2281 2281 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 2282 RelinquishSemaphoreInfo(png_semaphore);2282 UnlockSemaphoreInfo(png_semaphore); 2283 2283 #endif 2284 2284 if (quantum_info != (QuantumInfo *) NULL) … … 2636 2636 (void) SetImageBackgroundColor(image); 2637 2637 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 2638 RelinquishSemaphoreInfo(png_semaphore);2638 UnlockSemaphoreInfo(png_semaphore); 2639 2639 #endif 2640 2640 if (logging != MagickFalse) … … 2841 2841 png_pixels=(unsigned char *) RelinquishMagickMemory(png_pixels); 2842 2842 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 2843 RelinquishSemaphoreInfo(png_semaphore);2843 UnlockSemaphoreInfo(png_semaphore); 2844 2844 #endif 2845 2845 … … 5945 5945 entry->note=ConstantString(JNGNote); 5946 5946 (void) RegisterMagickInfo(entry); 5947 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 5948 png_semaphore=AllocateSemaphoreInfo(); 5949 #endif 5947 5950 return(MagickImageCoderSignature); 5948 5951 } … … 5976 5979 (void) UnregisterMagickInfo("JNG"); 5977 5980 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 5978 AcquireSemaphoreInfo(&png_semaphore);5979 RelinquishSemaphoreInfo(png_semaphore);5980 5981 DestroySemaphoreInfo(&png_semaphore); 5981 5982 #endif … … 6274 6275 6275 6276 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 6276 AcquireSemaphoreInfo(&png_semaphore);6277 LockSemaphoreInfo(png_semaphore); 6277 6278 #endif 6278 6279 … … 6321 6322 png_destroy_write_struct(&ping,&ping_info); 6322 6323 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 6323 RelinquishSemaphoreInfo(png_semaphore);6324 UnlockSemaphoreInfo(png_semaphore); 6324 6325 #endif 6325 6326 return(MagickFalse); … … 7424 7425 png_pixels=(unsigned char *) RelinquishMagickMemory(png_pixels); 7425 7426 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 7426 RelinquishSemaphoreInfo(png_semaphore);7427 UnlockSemaphoreInfo(png_semaphore); 7427 7428 #endif 7428 7429 return(MagickFalse); … … 7780 7781 7781 7782 #if defined(PNG_SETJMP_NOT_THREAD_SAFE) 7782 RelinquishSemaphoreInfo(png_semaphore);7783 UnlockSemaphoreInfo(png_semaphore); 7783 7784 #endif 7784 7785 -
ImageMagick/trunk/coders/tiff.c
r423 r453 1660 1660 MagickInfo 1661 1661 *entry; 1662 1663 AcquireSemaphoreInfo(&tiff_semaphore); 1662 1663 if (tiff_semaphore == (SemaphoreInfo *) NULL) 1664 tiff_semaphore=AllocateSemaphoreInfo(); 1665 LockSemaphoreInfo(tiff_semaphore); 1664 1666 if (instantiate_key == MagickFalse) 1665 1667 { … … 1668 1670 instantiate_key=MagickTrue; 1669 1671 } 1670 RelinquishSemaphoreInfo(tiff_semaphore);1672 UnlockSemaphoreInfo(tiff_semaphore); 1671 1673 *version='\0'; 1672 1674 #if defined(TIFF_VERSION) … … 1783 1785 (void) UnregisterMagickInfo("TIFF"); 1784 1786 (void) UnregisterMagickInfo("TIFF64"); 1785 AcquireSemaphoreInfo(&tiff_semaphore);1787 LockSemaphoreInfo(tiff_semaphore); 1786 1788 if (instantiate_key != MagickFalse) 1787 1789 if (MagickDeleteThreadKey(tiff_exception) == MagickFalse) 1788 1790 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); 1789 1791 instantiate_key=MagickFalse; 1790 RelinquishSemaphoreInfo(tiff_semaphore);1792 UnlockSemaphoreInfo(tiff_semaphore); 1791 1793 DestroySemaphoreInfo(&tiff_semaphore); 1792 1794 } -
ImageMagick/trunk/magick/cache.c
r446 r453 205 205 { 206 206 AcquireSemaphoreInfo(&cache_semaphore); 207 LockSemaphoreInfo(cache_semaphore); 207 208 if ((cache_resources == (SplayTreeInfo *) NULL) && 208 209 (instantiate_cache == MagickFalse)) … … 212 213 instantiate_cache=MagickTrue; 213 214 } 214 RelinquishSemaphoreInfo(cache_semaphore);215 UnlockSemaphoreInfo(cache_semaphore); 215 216 } 216 217 (void) AddValueToSplayTree(cache_resources,cache_info,cache_info); … … 284 285 MagickExport MagickBooleanType CacheComponentGenesis(void) 285 286 { 286 AcquireSemaphoreInfo(&cache_semaphore);287 RelinquishSemaphoreInfo(cache_semaphore);287 assert(cache_semaphore == (SemaphoreInfo *) NULL); 288 cache_semaphore=AllocateSemaphoreInfo(); 288 289 return(MagickTrue); 289 290 } … … 309 310 MagickExport void CacheComponentTerminus(void) 310 311 { 311 AcquireSemaphoreInfo(&cache_semaphore); 312 if (cache_semaphore == (SemaphoreInfo *) NULL) 313 AcquireSemaphoreInfo(&cache_semaphore); 314 LockSemaphoreInfo(cache_semaphore); 312 315 if (cache_resources != (SplayTreeInfo *) NULL) 313 316 cache_resources=DestroySplayTree(cache_resources); 314 317 instantiate_cache=MagickFalse; 315 RelinquishSemaphoreInfo(cache_semaphore);318 UnlockSemaphoreInfo(cache_semaphore); 316 319 DestroySemaphoreInfo(&cache_semaphore); 317 320 } … … 598 601 status; 599 602 600 AcquireSemaphoreInfo(&cache_info->disk_semaphore);603 LockSemaphoreInfo(cache_info->disk_semaphore); 601 604 status=close(cache_info->file); 602 605 cache_info->file=(-1); 603 606 RelinquishMagickResource(FileResource,1); 604 RelinquishSemaphoreInfo(cache_info->disk_semaphore);607 UnlockSemaphoreInfo(cache_info->disk_semaphore); 605 608 return(status == -1 ? MagickFalse : MagickTrue); 606 609 } … … 617 620 if (GetMagickResource(FileResource) < GetMagickResourceLimit(FileResource)) 618 621 return; 619 AcquireSemaphoreInfo(&cache_semaphore);622 LockSemaphoreInfo(cache_semaphore); 620 623 if (cache_resources == (SplayTreeInfo *) NULL) 621 624 { 622 RelinquishSemaphoreInfo(cache_semaphore);625 UnlockSemaphoreInfo(cache_semaphore); 623 626 return; 624 627 } … … 646 649 if (q != (CacheInfo *) NULL) 647 650 (void) ClosePixelCacheOnDisk(q); /* relinquish least recently used cache */ 648 RelinquishSemaphoreInfo(cache_semaphore);651 UnlockSemaphoreInfo(cache_semaphore); 649 652 } 650 653 … … 674 677 Open pixel cache on disk. 675 678 */ 676 AcquireSemaphoreInfo(&cache_info->disk_semaphore);679 LockSemaphoreInfo(cache_info->disk_semaphore); 677 680 if (cache_info->file != -1) 678 681 { 679 RelinquishSemaphoreInfo(cache_info->disk_semaphore);682 UnlockSemaphoreInfo(cache_info->disk_semaphore); 680 683 return(MagickTrue); /* cache already open */ 681 684 } … … 711 714 if (file == -1) 712 715 { 713 RelinquishSemaphoreInfo(cache_info->disk_semaphore);716 UnlockSemaphoreInfo(cache_info->disk_semaphore); 714 717 return(MagickFalse); 715 718 } … … 717 720 cache_info->file=file; 718 721 cache_info->timestamp=time(0); 719 RelinquishSemaphoreInfo(cache_info->disk_semaphore);722 UnlockSemaphoreInfo(cache_info->disk_semaphore); 720 723 return(MagickTrue); 721 724 } -
ImageMagick/trunk/magick/coder.c
r446 r453 256 256 MagickExport MagickBooleanType CoderComponentGenesis(void) 257 257 { 258 AcquireSemaphoreInfo(&coder_semaphore);259 RelinquishSemaphoreInfo(coder_semaphore);258 assert(coder_semaphore == (SemaphoreInfo *) NULL); 259 coder_semaphore=AllocateSemaphoreInfo(); 260 260 return(MagickTrue); 261 261 } … … 281 281 MagickExport void CoderComponentTerminus(void) 282 282 { 283 AcquireSemaphoreInfo(&coder_semaphore); 283 if (coder_semaphore == (SemaphoreInfo *) NULL) 284 AcquireSemaphoreInfo(&coder_semaphore); 285 LockSemaphoreInfo(coder_semaphore); 284 286 if (coder_list != (SplayTreeInfo *) NULL) 285 287 coder_list=DestroySplayTree(coder_list); 286 288 instantiate_coder=MagickFalse; 287 RelinquishSemaphoreInfo(coder_semaphore);289 UnlockSemaphoreInfo(coder_semaphore); 288 290 DestroySemaphoreInfo(&coder_semaphore); 289 291 } … … 402 404 Generate coder list. 403 405 */ 404 AcquireSemaphoreInfo(&coder_semaphore);406 LockSemaphoreInfo(coder_semaphore); 405 407 ResetSplayTreeIterator(coder_list); 406 408 p=(const CoderInfo *) GetNextValueInSplayTree(coder_list); … … 412 414 p=(const CoderInfo *) GetNextValueInSplayTree(coder_list); 413 415 } 414 RelinquishSemaphoreInfo(coder_semaphore);416 UnlockSemaphoreInfo(coder_semaphore); 415 417 qsort((void *) coder_map,(size_t) i,sizeof(*coder_map),CoderInfoCompare); 416 418 coder_map[i]=(CoderInfo *) NULL; … … 487 489 Generate coder list. 488 490 */ 489 AcquireSemaphoreInfo(&coder_semaphore);491 LockSemaphoreInfo(coder_semaphore); 490 492 ResetSplayTreeIterator(coder_list); 491 493 p=(const CoderInfo *) GetNextValueInSplayTree(coder_list); … … 497 499 p=(const CoderInfo *) GetNextValueInSplayTree(coder_list); 498 500 } 499 RelinquishSemaphoreInfo(coder_semaphore);501 UnlockSemaphoreInfo(coder_semaphore); 500 502 qsort((void *) coder_map,(size_t) i,sizeof(*coder_map),CoderCompare); 501 503 coder_map[i]=(char *) NULL; … … 532 534 { 533 535 AcquireSemaphoreInfo(&coder_semaphore); 536 LockSemaphoreInfo(coder_semaphore); 534 537 if ((coder_list == (SplayTreeInfo *) NULL) && 535 538 (instantiate_coder == MagickFalse)) … … 538 541 instantiate_coder=MagickTrue; 539 542 } 540 RelinquishSemaphoreInfo(coder_semaphore);543 UnlockSemaphoreInfo(coder_semaphore); 541 544 } 542 545 return(coder_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse); -
ImageMagick/trunk/magick/color.c
r446 r453 817 817 MagickExport MagickBooleanType ColorComponentGenesis(void) 818 818 { 819 AcquireSemaphoreInfo(&color_semaphore);820 RelinquishSemaphoreInfo(color_semaphore);819 assert(color_semaphore == (SemaphoreInfo *) NULL); 820 color_semaphore=AllocateSemaphoreInfo(); 821 821 return(MagickTrue); 822 822 } … … 860 860 MagickExport void ColorComponentTerminus(void) 861 861 { 862 AcquireSemaphoreInfo(&color_semaphore); 862 if (color_semaphore == (SemaphoreInfo *) NULL) 863 AcquireSemaphoreInfo(&color_semaphore); 864 LockSemaphoreInfo(color_semaphore); 863 865 if (color_list != (LinkedListInfo *) NULL) 864 866 color_list=DestroyLinkedList(color_list,DestroyColorElement); 865 867 instantiate_color=MagickFalse; 866 RelinquishSemaphoreInfo(color_semaphore);868 UnlockSemaphoreInfo(color_semaphore); 867 869 DestroySemaphoreInfo(&color_semaphore); 868 870 } … … 933 935 Search for color tag. 934 936 */ 935 AcquireSemaphoreInfo(&color_semaphore);937 LockSemaphoreInfo(color_semaphore); 936 938 ResetLinkedListIterator(color_list); 937 939 p=(const ColorInfo *) GetNextValueInLinkedList(color_list); … … 948 950 (void) InsertValueInLinkedList(color_list,0, 949 951 RemoveElementByValueFromLinkedList(color_list,p)); 950 RelinquishSemaphoreInfo(color_semaphore);952 UnlockSemaphoreInfo(color_semaphore); 951 953 return(p); 952 954 } … … 1021 1023 break; 1022 1024 } 1025 if ((pixel->colorspace == HSLColorspace) || 1026 (pixel->colorspace == HSBColorspace)) 1027 { 1028 (void) FormatMagickString(component,MaxTextExtent,"%g%%", 1029 (double) (100.0*QuantumScale*color)); 1030 (void) ConcatenateMagickString(tuple,component,MaxTextExtent); 1031 return; 1032 } 1023 1033 if (compliance != SVGCompliance) 1024 1034 { … … 1139 1149 Generate color list. 1140 1150 */ 1141 AcquireSemaphoreInfo(&color_semaphore);1151 LockSemaphoreInfo(color_semaphore); 1142 1152 ResetLinkedListIterator(color_list); 1143 1153 p=(const ColorInfo *) GetNextValueInLinkedList(color_list); … … 1149 1159 p=(const ColorInfo *) GetNextValueInLinkedList(color_list); 1150 1160 } 1151 RelinquishSemaphoreInfo(color_semaphore);1161 UnlockSemaphoreInfo(color_semaphore); 1152 1162 qsort((void *) colors,(size_t) i,sizeof(*colors),ColorInfoCompare); 1153 1163 colors[i]=(ColorInfo *) NULL; … … 1232 1242 Generate color list. 1233 1243 */ 1234 AcquireSemaphoreInfo(&color_semaphore);1244 LockSemaphoreInfo(color_semaphore); 1235 1245 ResetLinkedListIterator(color_list); 1236 1246 p=(const ColorInfo *) GetNextValueInLinkedList(color_list); … … 1242 1252 p=(const ColorInfo *) GetNextValueInLinkedList(color_list); 1243 1253 } 1244 RelinquishSemaphoreInfo(color_semaphore);1254 UnlockSemaphoreInfo(color_semaphore); 1245 1255 qsort((void *) colors,(size_t) i,sizeof(*colors),ColorCompare); 1246 1256 colors[i]=(char *) NULL; … … 1448 1458 { 1449 1459 AcquireSemaphoreInfo(&color_semaphore); 1460 LockSemaphoreInfo(color_semaphore); 1450 1461 if ((color_list == (LinkedListInfo *) NULL) && 1451 1462 (instantiate_color == MagickFalse)) … … 1454 1465 instantiate_color=MagickTrue; 1455 1466 } 1456 RelinquishSemaphoreInfo(color_semaphore);1467 UnlockSemaphoreInfo(color_semaphore); 1457 1468 } 1458 1469 return(color_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse); -
ImageMagick/trunk/magick/configure.c
r446 r453 115 115 MagickExport MagickBooleanType ConfigureComponentGenesis(void) 116 116 { 117 AcquireSemaphoreInfo(&configure_semaphore);118 RelinquishSemaphoreInfo(configure_semaphore);117 assert(configure_semaphore == (SemaphoreInfo *) NULL); 118 configure_semaphore=AllocateSemaphoreInfo(); 119 119 return(MagickTrue); 120 120 } … … 160 160 MagickExport void ConfigureComponentTerminus(void) 161 161 { 162 AcquireSemaphoreInfo(&configure_semaphore); 162 if (configure_semaphore == (SemaphoreInfo *) NULL) 163 AcquireSemaphoreInfo(&configure_semaphore); 164 LockSemaphoreInfo(configure_semaphore); 163 165 if (configure_list != (LinkedListInfo *) NULL) 164 166 configure_list=DestroyLinkedList(configure_list,DestroyConfigureElement); 165 167 configure_list=(LinkedListInfo *) NULL; 166 168 instantiate_configure=MagickFalse; 167 RelinquishSemaphoreInfo(configure_semaphore);169 UnlockSemaphoreInfo(configure_semaphore); 168 170 DestroySemaphoreInfo(&configure_semaphore); 169 171 } … … 253 255 Search for configure tag. 254 256 */ 255 AcquireSemaphoreInfo(&configure_semaphore);257 LockSemaphoreInfo(configure_semaphore); 256 258 ResetLinkedListIterator(configure_list); 257 259 p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); … … 265 267 (void) InsertValueInLinkedList(configure_list,0, 266 268 RemoveElementByValueFromLinkedList(configure_list,p)); 267 RelinquishSemaphoreInfo(configure_semaphore);269 UnlockSemaphoreInfo(configure_semaphore); 268 270 return(p); 269 271 } … … 349 351 Generate configure list. 350 352 */ 351 AcquireSemaphoreInfo(&configure_semaphore);353 LockSemaphoreInfo(configure_semaphore); 352 354 ResetLinkedListIterator(configure_list); 353 355 p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); … … 359 361 p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); 360 362 } 361 RelinquishSemaphoreInfo(configure_semaphore);363 UnlockSemaphoreInfo(configure_semaphore); 362 364 qsort((void *) options,(size_t) i,sizeof(*options),ConfigureInfoCompare); 363 365 options[i]=(ConfigureInfo *) NULL; … … 436 438 if (p == (const ConfigureInfo *) NULL) 437 439 return((char **) NULL); 438 AcquireSemaphoreInfo(&configure_semaphore);439 RelinquishSemaphoreInfo(configure_semaphore);440 440 options=(char **) AcquireQuantumMemory((size_t) 441 441 GetNumberOfElementsInLinkedList(configure_list)+1UL,sizeof(*options)); 442 442 if (options == (char **) NULL) 443 443 return((char **) NULL); 444 AcquireSemaphoreInfo(&configure_semaphore);444 LockSemaphoreInfo(configure_semaphore); 445 445 ResetLinkedListIterator(configure_list); 446 446 p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); … … 452 452 p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); 453 453 } 454 RelinquishSemaphoreInfo(configure_semaphore);454 UnlockSemaphoreInfo(configure_semaphore); 455 455 qsort((void *) options,(size_t) i,sizeof(*options),ConfigureCompare); 456 456 options[i]=(char *) NULL; … … 870 870 { 871 871 AcquireSemaphoreInfo(&configure_semaphore); 872 LockSemaphoreInfo(configure_semaphore); 872 873 if ((configure_list == (LinkedListInfo *) NULL) && 873 874 (instantiate_configure == MagickFalse)) … … 876 877 instantiate_configure=MagickTrue; 877 878 } 878 RelinquishSemaphoreInfo(configure_semaphore);879 UnlockSemaphoreInfo(configure_semaphore); 879 880 } 880 881 return(configure_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse); -
ImageMagick/trunk/magick/constitute.c
r446 r453 95 95 MagickExport MagickBooleanType ConstituteComponentGenesis(void) 96 96 { 97 AcquireSemaphoreInfo(&constitute_semaphore);98 RelinquishSemaphoreInfo(constitute_semaphore);97 assert(constitute_semaphore == (SemaphoreInfo *) NULL); 98 constitute_semaphore=AllocateSemaphoreInfo(); 99 99 return(MagickTrue); 100 100 } … … 120 120 MagickExport void ConstituteComponentTerminus(void) 121 121 { 122 if (constitute_semaphore != (SemaphoreInfo *) NULL) 123 DestroySemaphoreInfo(&constitute_semaphore); 122 if (constitute_semaphore == (SemaphoreInfo *) NULL) 123 AcquireSemaphoreInfo(&constitute_semaphore); 124 DestroySemaphoreInfo(&constitute_semaphore); 124 125 } 125 126 … … 515 516 thread_support=GetMagickThreadSupport(magick_info); 516 517 if ((thread_support & DecoderThreadSupport) == 0) 517 AcquireSemaphoreInfo(&constitute_semaphore); 518 { 519 AcquireSemaphoreInfo(&constitute_semaphore); 520 LockSemaphoreInfo(constitute_semaphore); 521 } 518 522 image=GetImageDecoder(magick_info)(read_info,exception); 519 523 if ((thread_support & DecoderThreadSupport) == 0) 520 RelinquishSemaphoreInfo(constitute_semaphore);524 UnlockSemaphoreInfo(constitute_semaphore); 521 525 } 522 526 else … … 547 551 *read_info->filename='\0'; 548 552 if (GetDelegateThreadSupport(delegate_info) == MagickFalse) 549 AcquireSemaphoreInfo(&constitute_semaphore); 553 { 554 AcquireSemaphoreInfo(&constitute_semaphore); 555 LockSemaphoreInfo(constitute_semaphore); 556 } 550 557 (void) InvokeDelegate(read_info,image,read_info->magick,(char *) NULL, 551 558 exception); 552 559 if (GetDelegateThreadSupport(delegate_info) == MagickFalse) 553 RelinquishSemaphoreInfo(constitute_semaphore);560 UnlockSemaphoreInfo(constitute_semaphore); 554 561 image=DestroyImageList(image); 555 562 read_info->temporary=MagickTrue; … … 571 578 thread_support=GetMagickThreadSupport(magick_info); 572 579 if ((thread_support & DecoderThreadSupport) == 0) 573 AcquireSemaphoreInfo(&constitute_semaphore); 580 { 581 AcquireSemaphoreInfo(&constitute_semaphore); 582 LockSemaphoreInfo(constitute_semaphore); 583 } 574 584 image=(Image *) (GetImageDecoder(magick_info))(read_info,exception); 575 585 if ((thread_support & DecoderThreadSupport) == 0) 576 RelinquishSemaphoreInfo(constitute_semaphore);586 UnlockSemaphoreInfo(constitute_semaphore); 577 587 } 578 588 if (read_info->temporary != MagickFalse) … … 1100 1110 thread_support=GetMagickThreadSupport(magick_info); 1101 1111 if ((thread_support & EncoderThreadSupport) == 0) 1102 AcquireSemaphoreInfo(&constitute_semaphore); 1112 { 1113 AcquireSemaphoreInfo(&constitute_semaphore); 1114 LockSemaphoreInfo(constitute_semaphore); 1115 } 1103 1116 status=GetImageEncoder(magick_info)(write_info,image); 1104 1117 if ((thread_support & EncoderThreadSupport) == 0) 1105 RelinquishSemaphoreInfo(constitute_semaphore);1118 UnlockSemaphoreInfo(constitute_semaphore); 1106 1119 } 1107 1120 else … … 1116 1129 *write_info->filename='\0'; 1117 1130 if (GetDelegateThreadSupport(delegate_info) == MagickFalse) 1118 AcquireSemaphoreInfo(&constitute_semaphore); 1131 { 1132 AcquireSemaphoreInfo(&constitute_semaphore); 1133 LockSemaphoreInfo(constitute_semaphore); 1134 } 1119 1135 status=InvokeDelegate(write_info,image,(char *) NULL, 1120 1136 write_info->magick,&image->exception); 1121 1137 if (GetDelegateThreadSupport(delegate_info) == MagickFalse) 1122 RelinquishSemaphoreInfo(constitute_semaphore);1138 UnlockSemaphoreInfo(constitute_semaphore); 1123 1139 (void) CopyMagickString(image->filename,filename,MaxTextExtent); 1124 1140 } … … 1147 1163 thread_support=GetMagickThreadSupport(magick_info); 1148 1164 if ((thread_support & EncoderThreadSupport) == 0) 1149 AcquireSemaphoreInfo(&constitute_semaphore); 1165 { 1166 AcquireSemaphoreInfo(&constitute_semaphore); 1167 LockSemaphoreInfo(constitute_semaphore); 1168 } 1150 1169 status=GetImageEncoder(magick_info)(write_info,image); 1151 1170 if ((thread_support & EncoderThreadSupport) == 0) 1152 RelinquishSemaphoreInfo(constitute_semaphore);1171 UnlockSemaphoreInfo(constitute_semaphore); 1153 1172 } 1154 1173 } -
ImageMagick/trunk/magick/delegate.c
r446 r453 165 165 MagickExport MagickBooleanType DelegateComponentGenesis(void) 166 166 { 167 AcquireSemaphoreInfo(&delegate_semaphore);168 RelinquishSemaphoreInfo(delegate_semaphore);167 assert(delegate_semaphore == (SemaphoreInfo *) NULL); 168 delegate_semaphore=AllocateSemaphoreInfo(); 169 169 return(MagickTrue); 170 170 } … … 210 210 MagickExport void DelegateComponentTerminus(void) 211 211 { 212 AcquireSemaphoreInfo(&delegate_semaphore); 212 if (delegate_semaphore == (SemaphoreInfo *) NULL) 213 AcquireSemaphoreInfo(&delegate_semaphore); 214 LockSemaphoreInfo(delegate_semaphore); 213 215 if (delegate_list != (LinkedListInfo *) NULL) 214 216 delegate_list=DestroyLinkedList(delegate_list,DestroyDelegate); 215 217 instantiate_delegate=MagickFalse; 216 RelinquishSemaphoreInfo(delegate_semaphore);218 UnlockSemaphoreInfo(delegate_semaphore); 217 219 DestroySemaphoreInfo(&delegate_semaphore); 218 220 } … … 380 382 Search for named delegate. 381 383 */ 382 AcquireSemaphoreInfo(&delegate_semaphore);384 LockSemaphoreInfo(delegate_semaphore); 383 385 ResetLinkedListIterator(delegate_list); 384 386 p=(const DelegateInfo *) GetNextValueInLinkedList(delegate_list); … … 413 415 (void) InsertValueInLinkedList(delegate_list,0, 414 416 RemoveElementByValueFromLinkedList(delegate_list,p)); 415 RelinquishSemaphoreInfo(delegate_semaphore);417 UnlockSemaphoreInfo(delegate_semaphore); 416 418 return(p); 417 419 } … … 504 506 Generate delegate list. 505 507 */ 506 AcquireSemaphoreInfo(&delegate_semaphore);508 LockSemaphoreInfo(delegate_semaphore); 507 509 ResetLinkedListIterator(delegate_list); 508 510 p=(const DelegateInfo *) GetNextValueInLinkedList(delegate_list); … … 515 517 p=(const DelegateInfo *) GetNextValueInLinkedList(delegate_list); 516 518 } 517 RelinquishSemaphoreInfo(delegate_semaphore);519 UnlockSemaphoreInfo(delegate_semaphore); 518 520 qsort((void *) delegates,(size_t) i,sizeof(*delegates),DelegateInfoCompare); 519 521 delegates[i]=(DelegateInfo *) NULL; … … 597 599 if (delegates == (char **) NULL) 598 600 return((char **) NULL); 599 AcquireSemaphoreInfo(&delegate_semaphore);601 LockSemaphoreInfo(delegate_semaphore); 600 602 ResetLinkedListIterator(delegate_list); 601 603 p=(const DelegateInfo *) GetNextValueInLinkedList(delegate_list); … … 610 612 p=(const DelegateInfo *) GetNextValueInLinkedList(delegate_list); 611 613 } 612 RelinquishSemaphoreInfo(delegate_semaphore);614 UnlockSemaphoreInfo(delegate_semaphore); 613 615 qsort((void *) delegates,(size_t) i,sizeof(*delegates),DelegateCompare); 614 616 delegates[i]=(char *) NULL; … … 708 710 { 709 711 AcquireSemaphoreInfo(&delegate_semaphore); 712 LockSemaphoreInfo(delegate_semaphore); 710 713 if ((delegate_list == (LinkedListInfo *) NULL) && 711 714 (instantiate_delegate == MagickFalse)) … … 714 717 instantiate_delegate=MagickTrue; 715 718 } 716 RelinquishSemaphoreInfo(delegate_semaphore);719 UnlockSemaphoreInfo(delegate_semaphore); 717 720 } 718 721 return(delegate_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse); -
ImageMagick/trunk/magick/deprecate.c
r446 r453 3759 3759 { 3760 3760 (void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.7"); 3761 RelinquishSemaphoreInfo(*semaphore_info);3761 UnlockSemaphoreInfo(*semaphore_info); 3762 3762 } 3763 3763 -
ImageMagick/trunk/magick/exception.c
r114 r453 159 159 if (exception->exceptions == (void *) NULL) 160 160 return; 161 AcquireSemaphoreInfo(&exception->semaphore);161 LockSemaphoreInfo(exception->semaphore); 162 162 p=(ExceptionInfo *) RemoveLastElementFromLinkedList((LinkedListInfo *) 163 163 exception->exceptions); … … 171 171 exception->reason=(char *) NULL; 172 172 exception->description=(char *) NULL; 173 RelinquishSemaphoreInfo(exception->semaphore);173 UnlockSemaphoreInfo(exception->semaphore); 174 174 errno=0; 175 175 } … … 207 207 if (exception->exceptions == (void *) NULL) 208 208 return; 209 AcquireSemaphoreInfo(&exception->semaphore);209 LockSemaphoreInfo(exception->semaphore); 210 210 ResetLinkedListIterator((LinkedListInfo *) exception->exceptions); 211 211 p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) … … 222 222 exception->exceptions); 223 223 } 224 RelinquishSemaphoreInfo(exception->semaphore);224 UnlockSemaphoreInfo(exception->semaphore); 225 225 ClearMagickException(exception); 226 226 } … … 379 379 assert(exception != (ExceptionInfo *) NULL); 380 380 assert(exception->signature == MagickSignature); 381 AcquireSemaphoreInfo(&exception->semaphore);381 LockSemaphoreInfo(exception->semaphore); 382 382 exception->severity=UndefinedException; 383 383 if (exception->exceptions != (void *) NULL) … … 387 387 if (exception->relinquish != MagickFalse) 388 388 exception->signature=(~MagickSignature); 389 RelinquishSemaphoreInfo(exception->semaphore);389 UnlockSemaphoreInfo(exception->semaphore); 390 390 DestroySemaphoreInfo(&exception->semaphore); 391 391 if (relinquish != MagickFalse) … … 422 422 exception->severity=UndefinedException; 423 423 exception->exceptions=(void *) NewLinkedList(0); 424 exception->semaphore=AllocateSemaphoreInfo(); 424 425 exception->signature=MagickSignature; 425 426 } … … 613 614 if (relative->exceptions == (void *) NULL) 614 615 return; 615 AcquireSemaphoreInfo(&exception->semaphore);616 LockSemaphoreInfo(exception->semaphore); 616 617 ResetLinkedListIterator((LinkedListInfo *) relative->exceptions); 617 618 p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) … … 623 624 relative->exceptions); 624 625 } 625 RelinquishSemaphoreInfo(exception->semaphore);626 UnlockSemaphoreInfo(exception->semaphore); 626 627 } 627 628 -
ImageMagick/trunk/magick/gem.c
r432 r453 373 373 if (delta == 0.0) 374 374 return; 375 if ( red == max)376 *hue=( (((max-blue)/6.0)+(delta/2.0))-(((max-green)/6.0)+(delta/2.0)))/delta;375 if ((MagickRealType) red == max) 376 *hue=(double) ((green-(MagickRealType) blue)/delta); 377 377 else 378 if (green == max) 379 *hue=(1.0/3.0)+((((max-red)/6.0)+(delta/2.0))-(((max-blue)/6.0)+ 380 (delta/2.0)))/delta; 378 if ((MagickRealType) green == max) 379 *hue=(double) (2.0+(blue-(MagickRealType) red)/delta); 381 380 else 382 if (blue == max) 383 *hue=(2.0/3.0)+((((max-green)/6.0)+(delta/2.0))-(((max-red)/6.0)+ 384 (delta/2.0)))/delta; 381 *hue=(double) (4.0+(red-(MagickRealType) green)/delta); 382 *hue/=6.0; 385 383 if (*hue < 0.0) 386 384 *hue+=1.0; 387 if (*hue > 1.0)388 *hue-=1.0;389 385 } 390 386 -
ImageMagick/trunk/magick/image.c
r404 r453 1628 1628 if (image->debug != MagickFalse) 1629 1629 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); 1630 AcquireSemaphoreInfo(&image->semaphore);1630 LockSemaphoreInfo(image->semaphore); 1631 1631 reference_count=image->reference_count; 1632 RelinquishSemaphoreInfo(image->semaphore);1632 UnlockSemaphoreInfo(image->semaphore); 1633 1633 return(reference_count); 1634 1634 } … … 2067 2067 return(MagickTrue); 2068 2068 clone_image=CloneImage(*image,0,0,MagickTrue,exception); 2069 AcquireSemaphoreInfo(&(*image)->semaphore);2069 LockSemaphoreInfo((*image)->semaphore); 2070 2070 (*image)->reference_count--; 2071 RelinquishSemaphoreInfo((*image)->semaphore);2071 UnlockSemaphoreInfo((*image)->semaphore); 2072 2072 *image=clone_image; 2073 2073 return(MagickTrue); -
ImageMagick/trunk/magick/locale.c
r446 r453 255 255 Generate locale list. 256 256 */ 257 AcquireSemaphoreInfo(&locale_semaphore);257 LockSemaphoreInfo(locale_semaphore); 258 258 ResetSplayTreeIterator(locale_list); 259 259 p=(const LocaleInfo *) GetNextValueInSplayTree(locale_list); … … 265 265 p=(const LocaleInfo *) GetNextValueInSplayTree(locale_list); 266 266 } 267 RelinquishSemaphoreInfo(locale_semaphore);267 UnlockSemaphoreInfo(locale_semaphore); 268 268 qsort((void *) messages,(size_t) i,sizeof(*messages),LocaleInfoCompare); 269 269 messages[i]=(LocaleInfo *) NULL; … … 343 343 if (p == (const LocaleInfo *) NULL) 344 344 return((char **) NULL); 345 AcquireSemaphoreInfo(&locale_semaphore);346 RelinquishSemaphoreInfo(locale_semaphore);347 345 messages=(char **) AcquireQuantumMemory((size_t) 348 346 GetNumberOfNodesInSplayTree(locale_list)+1UL,sizeof(*messages)); 349 347 if (messages == (char **) NULL) 350 348 return((char **) NULL); 351 AcquireSemaphoreInfo(&locale_semaphore);349 LockSemaphoreInfo(locale_semaphore); 352 350 p=(const LocaleInfo *) GetNextValueInSplayTree(locale_list); 353 351 for (i=0; p != (const LocaleInfo *) NULL; ) … … 358 356 p=(const LocaleInfo *) GetNextValueInSplayTree(locale_list); 359 357 } 360 RelinquishSemaphoreInfo(locale_semaphore);358 UnlockSemaphoreInfo(locale_semaphore); 361 359 qsort((void *) messages,(size_t) i,sizeof(*messages),LocaleTagCompare); 362 360 messages[i]=(char *) NULL; … … 553 551 { 554 552 AcquireSemaphoreInfo(&locale_semaphore); 553 LockSemaphoreInfo(locale_semaphore); 555 554 if ((locale_list == (SplayTreeInfo *) NULL) && 556 555 (instantiate_locale == MagickFalse)) … … 580 579 instantiate_locale=MagickTrue; 581 580 } 582 RelinquishSemaphoreInfo(locale_semaphore);581 UnlockSemaphoreInfo(locale_semaphore); 583 582 } 584 583 return(locale_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse); … … 1049 1048 MagickExport MagickBooleanType LocaleComponentGenesis(void) 1050 1049 { 1051 AcquireSemaphoreInfo(&locale_semaphore);1052 RelinquishSemaphoreInfo(locale_semaphore);1050 assert(locale_semaphore == (SemaphoreInfo *) NULL); 1051 locale_semaphore=AllocateSemaphoreInfo(); 1053 1052 return(MagickTrue); 1054 1053 } … … 1074 1073 MagickExport void LocaleComponentTerminus(void) 1075 1074 { 1076 AcquireSemaphoreInfo(&locale_semaphore); 1075 if (locale_semaphore == (SemaphoreInfo *) NULL) 1076 AcquireSemaphoreInfo(&locale_semaphore); 1077 LockSemaphoreInfo(locale_semaphore); 1077 1078 if (locale_list != (SplayTreeInfo *) NULL) 1078 1079 locale_list=DestroySplayTree(locale_list); 1079 1080 instantiate_locale=MagickFalse; 1080 RelinquishSemaphoreInfo(locale_semaphore);1081 UnlockSemaphoreInfo(locale_semaphore); 1081 1082 DestroySemaphoreInfo(&locale_semaphore); 1082 1083 } -
ImageMagick/trunk/magick/log.c
r446 r453 226 226 log_info=GetLogInfo("*",exception); 227 227 exception=DestroyExceptionInfo(exception); 228 AcquireSemaphoreInfo(&log_semaphore);228 LockSemaphoreInfo(log_semaphore); 229 229 if (log_info->file != (FILE *) NULL) 230 230 { … … 234 234 log_info->file=(FILE *) NULL; 235 235 } 236 RelinquishSemaphoreInfo(log_semaphore);236 UnlockSemaphoreInfo(log_semaphore); 237 237 } 238 238 … … 279 279 Search for log tag. 280 280 */ 281 AcquireSemaphoreInfo(&log_semaphore);281 LockSemaphoreInfo(log_semaphore); 282 282 ResetLinkedListIterator(log_list); 283 283 p=(LogInfo *) GetNextValueInLinkedList(log_list); … … 291 291 (void) InsertValueInLinkedList(log_list,0, 292 292 RemoveElementByValueFromLinkedList(log_list,p)); 293 RelinquishSemaphoreInfo(log_semaphore);293 UnlockSemaphoreInfo(log_semaphore); 294 294 return(p); 295 295 } … … 372 372 Generate log list. 373 373 */ 374 AcquireSemaphoreInfo(&log_semaphore);374 LockSemaphoreInfo(log_semaphore); 375 375 ResetLinkedListIterator(log_list); 376 376 p=(const LogInfo *) GetNextValueInLinkedList(log_list); … … 382 382 p=(const LogInfo *) GetNextValueInLinkedList(log_list); 383 383 } 384 RelinquishSemaphoreInfo(log_semaphore);384 UnlockSemaphoreInfo(log_semaphore); 385 385 qsort((void *) preferences,(size_t) i,sizeof(*preferences),LogInfoCompare); 386 386 preferences[i]=(LogInfo *) NULL; … … 465 465 Generate log list. 466 466 */ 467 AcquireSemaphoreInfo(&log_semaphore);467 LockSemaphoreInfo(log_semaphore); 468 468 ResetLinkedListIterator(log_list); 469 469 p=(const LogInfo *) GetNextValueInLinkedList(log_list); … … 475 475 p=(const LogInfo *) GetNextValueInLinkedList(log_list); 476 476 } 477 RelinquishSemaphoreInfo(log_semaphore);477 UnlockSemaphoreInfo(log_semaphore); 478 478 qsort((void *) preferences,(size_t) i,sizeof(*preferences),LogCompare); 479 479 preferences[i]=(char *) NULL; … … 532 532 { 533 533 AcquireSemaphoreInfo(&log_semaphore); 534 LockSemaphoreInfo(log_semaphore); 534 535 if ((log_list == (LinkedListInfo *) NULL) && 535 536 (instantiate_log == MagickFalse)) … … 538 539 instantiate_log=MagickTrue; 539 540 } 540 RelinquishSemaphoreInfo(log_semaphore);541 UnlockSemaphoreInfo(log_semaphore); 541 542 } 542 543 return(log_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse); … … 683 684 MagickExport MagickBooleanType LogComponentGenesis(void) 684 685 { 685 AcquireSemaphoreInfo(&log_semaphore);686 RelinquishSemaphoreInfo(log_semaphore);686 assert(log_semaphore == (SemaphoreInfo *) NULL); 687 log_semaphore=AllocateSemaphoreInfo(); 687 688 return(MagickTrue); 688 689 } … … 735 736 MagickExport void LogComponentTerminus(void) 736 737 { 737 AcquireSemaphoreInfo(&log_semaphore); 738 if (log_semaphore == (SemaphoreInfo *) NULL) 739 AcquireSemaphoreInfo(&log_semaphore); 740 LockSemaphoreInfo(log_semaphore); 738 741 if (log_list != (LinkedListInfo *) NULL) 739 742 log_list=DestroyLinkedList(log_list,DestroyLogElement); 740 743 instantiate_log=MagickFalse; 741 RelinquishSemaphoreInfo(log_semaphore);744 UnlockSemaphoreInfo(log_semaphore); 742 745 DestroySemaphoreInfo(&log_semaphore); 743 746 } … … 1124 1127 log_info=(LogInfo *) GetLogInfo("*",exception); 1125 1128 exception=DestroyExceptionInfo(exception); 1126 AcquireSemaphoreInfo(&log_semaphore);1129 LockSemaphoreInfo(log_semaphore); 1127 1130 if ((log_info->event_mask & type) == 0) 1128 1131 { 1129 RelinquishSemaphoreInfo(log_semaphore);1132 UnlockSemaphoreInfo(log_semaphore); 1130 1133 return(MagickTrue); 1131 1134 } … … 1142 1145 { 1143 1146 (void) ContinueTimer((TimerInfo *) &log_info->timer); 1144 RelinquishSemaphoreInfo(log_semaphore);1147 UnlockSemaphoreInfo(log_semaphore); 1145 1148 return(MagickFalse); 1146 1149 } … … 1185 1188 { 1186 1189 (void) ContinueTimer((TimerInfo *) &log_info->timer); 1187 RelinquishSemaphoreInfo(log_semaphore);1190 UnlockSemaphoreInfo(log_semaphore); 1188 1191 return(MagickFalse); 1189 1192 } … … 1193 1196 if (log_info->file == (FILE *) NULL) 1194 1197 { 1195 RelinquishSemaphoreInfo(log_semaphore);1198 UnlockSemaphoreInfo(log_semaphore); 1196 1199 return(MagickFalse); 1197 1200 } … … 1219 1222 text=(char *) RelinquishMagickMemory(text); 1220 1223 (void) ContinueTimer((TimerInfo *) &log_info->timer); 1221 RelinquishSemaphoreInfo(log_semaphore);1224 UnlockSemaphoreInfo(log_semaphore); 1222 1225 return(MagickTrue); 1223 1226 } … … 1682 1685 exception=DestroyExceptionInfo(exception); 1683 1686 option=ParseMagickOption(MagickLogEventOptions,MagickTrue,events); 1684 AcquireSemaphoreInfo(&log_semaphore);1687 LockSemaphoreInfo(log_semaphore); 1685 1688 log_info=(LogInfo *) GetValueFromLinkedList(log_list,0); 1686 1689 log_info->event_mask=(LogEventType) option; 1687 1690 if (option == -1) 1688 1691 log_info->event_mask=UndefinedEvents; 1689 RelinquishSemaphoreInfo(log_semaphore);1692 UnlockSemaphoreInfo(log_semaphore); 1690 1693 return(log_info->event_mask); 1691 1694 } … … 1724 1727 log_info=(LogInfo *) GetLogInfo("*",exception); 1725 1728 exception=DestroyExceptionInfo(exception); 1726 AcquireSemaphoreInfo(&log_semaphore);1729 LockSemaphoreInfo(log_semaphore); 1727 1730 if (log_info->format != (char *) NULL) 1728 1731 log_info->format=DestroyString(log_info->format); 1729 1732 log_info->format=ConstantString(format); 1730 RelinquishSemaphoreInfo(log_semaphore);1733 UnlockSemaphoreInfo(log_semaphore); 1731 1734 } 1732 1735 -
ImageMagick/trunk/magick/magic.c
r446 r453 260 260 Search for magic tag. 261 261 */ 262 AcquireSemaphoreInfo(&magic_semaphore);262 LockSemaphoreInfo(magic_semaphore); 263 263 ResetLinkedListIterator(magic_list); 264 264 p=(const MagicInfo *) GetNextValueInLinkedList(magic_list); … … 274 274 (void) InsertValueInLinkedList(magic_list,0, 275 275 RemoveElementByValueFromLinkedList(magic_list,p)); 276 RelinquishSemaphoreInfo(magic_semaphore);276 UnlockSemaphoreInfo(magic_semaphore); 277 277 return(p); 278 278 } … … 357 357 Generate magic list. 358 358 */ 359 AcquireSemaphoreInfo(&magic_semaphore);359 LockSemaphoreInfo(magic_semaphore); 360 360 ResetLinkedListIterator(magic_list); 361 361 p=(const MagicInfo *) GetNextValueInLinkedList(magic_list); … … 367 367 p=(const MagicInfo *) GetNextValueInLinkedList(magic_list); 368 368 } 369 RelinquishSemaphoreInfo(magic_semaphore);369 UnlockSemaphoreInfo(magic_semaphore); 370 370 qsort((void *) aliases,(size_t) i,sizeof(*aliases),MagicInfoCompare); 371 371 aliases[i]=(MagicInfo *) NULL; … … 449 449 if (aliases == (char **) NULL) 450 450 return((char **) NULL); 451 AcquireSemaphoreInfo(&magic_semaphore);451 LockSemaphoreInfo(magic_semaphore); 452 452 ResetLinkedListIterator(magic_list); 453 453 p=(const MagicInfo *) GetNextValueInLinkedList(magic_list); … … 459 459 p=(const MagicInfo *) GetNextValueInLinkedList(magic_list); 460 460 } 461 RelinquishSemaphoreInfo(magic_semaphore);461 UnlockSemaphoreInfo(magic_semaphore); 462 462 qsort((void *) aliases,(size_t) i,sizeof(*aliases),MagicCompare); 463 463 aliases[i]=(char *) NULL; … … 524 524 { 525 525 AcquireSemaphoreInfo(&magic_semaphore); 526 LockSemaphoreInfo(magic_semaphore); 526 527 if ((magic_list == (LinkedListInfo *) NULL) && 527 528 (instantiate_magic == MagickFalse)) … … 530 531 instantiate_magic=MagickTrue; 531 532 } 532 RelinquishSemaphoreInfo(magic_semaphore);533 UnlockSemaphoreInfo(magic_semaphore); 533 534 } 534 535 return(magic_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse); … … 1011 1012 MagickExport MagickBooleanType MagicComponentGenesis(void) 1012 1013 { 1013 AcquireSemaphoreInfo(&magic_semaphore);1014 RelinquishSemaphoreInfo(magic_semaphore);1014 assert(magic_semaphore == (SemaphoreInfo *) NULL); 1015 magic_semaphore=AllocateSemaphoreInfo(); 1015 1016 return(MagickTrue); 1016 1017 } … … 1058 1059 MagickExport void MagicComponentTerminus(void) 1059 1060 { 1060 AcquireSemaphoreInfo(&magic_semaphore); 1061 if (magic_semaphore == (SemaphoreInfo *) NULL) 1062 AcquireSemaphoreInfo(&magic_semaphore); 1063 LockSemaphoreInfo(magic_semaphore); 1061 1064 if (magic_list != (LinkedListInfo *) NULL) 1062 1065 magic_list=DestroyLinkedList(magic_list,DestroyMagicElement); 1063 1066 instantiate_magic=MagickFalse; 1064 RelinquishSemaphoreInfo(magic_semaphore);1067 UnlockSemaphoreInfo(magic_semaphore); 1065 1068 DestroySemaphoreInfo(&magic_semaphore); 1066 1069 } -
ImageMagick/trunk/magick/magick.c
r446 r453 229 229 return(MagickFalse); 230 230 status=MagickFalse; 231 AcquireSemaphoreInfo(&magick_semaphore);231 LockSemaphoreInfo(magick_semaphore); 232 232 ResetSplayTreeIterator(magick_list); 233 233 p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); … … 243 243 p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); 244 244 } 245 RelinquishSemaphoreInfo(magick_semaphore);245 UnlockSemaphoreInfo(magick_semaphore); 246 246 return(status); 247 247 } … … 413 413 (void) OpenModules(exception); 414 414 #endif 415 AcquireSemaphoreInfo(&magick_semaphore);415 LockSemaphoreInfo(magick_semaphore); 416 416 ResetSplayTreeIterator(magick_list); 417 417 p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); 418 RelinquishSemaphoreInfo(magick_semaphore);418 UnlockSemaphoreInfo(magick_semaphore); 419 419 return(p); 420 420 } … … 422 422 Find name in list. 423 423 */ 424 AcquireSemaphoreInfo(&magick_semaphore);424 LockSemaphoreInfo(magick_semaphore); 425 425 ResetSplayTreeIterator(magick_list); 426 426 p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); … … 446 446 } 447 447 #endif 448 RelinquishSemaphoreInfo(magick_semaphore);448 UnlockSemaphoreInfo(magick_semaphore); 449 449 return(p); 450 450 } … … 527 527 Generate magick list. 528 528 */ 529 AcquireSemaphoreInfo(&magick_semaphore);529 LockSemaphoreInfo(magick_semaphore); 530 530 ResetSplayTreeIterator(magick_list); 531 531 p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); … … 537 537 p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); 538 538 } 539 RelinquishSemaphoreInfo(magick_semaphore);539 UnlockSemaphoreInfo(magick_semaphore); 540 540 qsort((void *) formats,(size_t) i,sizeof(*formats),MagickInfoCompare); 541 541 formats[i]=(MagickInfo *) NULL; … … 617 617 if (formats == (char **) NULL) 618 618 return((char **) NULL); 619 AcquireSemaphoreInfo(&magick_semaphore);619 LockSemaphoreInfo(magick_semaphore); 620 620 ResetSplayTreeIterator(magick_list); 621 621 p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); … … 627 627 p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); 628 628 } 629 RelinquishSemaphoreInfo(magick_semaphore);629 UnlockSemaphoreInfo(magick_semaphore); 630 630 qsort((void *) formats,(size_t) i,sizeof(*formats),MagickCompare); 631 631 formats[i]=(char *) NULL; … … 777 777 { 778 778 AcquireSemaphoreInfo(&magick_semaphore); 779 LockSemaphoreInfo(magick_semaphore); 779 780 if ((magick_list == (SplayTreeInfo *) NULL) && 780 781 (instantiate_magick == MagickFalse)) … … 818 819 instantiate_magick=MagickTrue; 819 820 } 820 RelinquishSemaphoreInfo(magick_semaphore);821 UnlockSemaphoreInfo(magick_semaphore); 821 822 } 822 823 return(magick_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse); … … 1030 1031 MagickExport MagickBooleanType MagickComponentGenesis(void) 1031 1032 { 1032 AcquireSemaphoreInfo(&magick_semaphore);1033 RelinquishSemaphoreInfo(magick_semaphore);1033 assert(magick_semaphore == (SemaphoreInfo *) NULL); 1034 magick_semaphore=AllocateSemaphoreInfo(); 1034 1035 return(MagickTrue); 1035 1036 } … … 1055 1056 MagickExport void MagickComponentTerminus(void) 1056 1057 { 1057 AcquireSemaphoreInfo(&magick_semaphore); 1058 if (magick_semaphore == (SemaphoreInfo *) NULL) 1059 AcquireSemaphoreInfo(&magick_semaphore); 1060 LockSemaphoreInfo(magick_semaphore); 1058 1061 if (magick_list != (SplayTreeInfo *) NULL) 1059 1062 magick_list=DestroySplayTree(magick_list); 1060 1063 instantiate_magick=MagickFalse; 1061 RelinquishSemaphoreInfo(magick_semaphore);1064 UnlockSemaphoreInfo(magick_semaphore); 1062 1065 DestroySemaphoreInfo(&magick_semaphore); 1063 1066 } … … 1262 1265 Instantiate magick resources. 1263 1266 */ 1267 (void) ConfigureComponentGenesis(); 1264 1268 (void) PolicyComponentGenesis(); 1265 1269 (void) CacheComponentGenesis(); … … 1275 1279 (void) ColorComponentGenesis(); 1276 1280 (void) TypeComponentGenesis(); 1277 (void) ConfigureComponentGenesis();1278 1281 (void) MimeComponentGenesis(); 1279 1282 (void) ConstituteComponentGenesis(); … … 1306 1309 ConstituteComponentTerminus(); 1307 1310 MimeComponentTerminus(); 1308 ConfigureComponentTerminus();1309 1311 TypeComponentTerminus(); 1310 1312 ColorComponentTerminus(); … … 1326 1328 CacheComponentTerminus(); 1327 1329 PolicyComponentTerminus(); 1330 ConfigureComponentTerminus(); 1328 1331 RandomComponentTerminus(); 1329 1332 LocaleComponentTerminus(); … … 1462 1465 if (GetNumberOfNodesInSplayTree(magick_list) == 0) 1463 1466 return(MagickFalse); 1464 AcquireSemaphoreInfo(&magick_semaphore);1467 LockSemaphoreInfo(magick_semaphore); 1465 1468 ResetSplayTreeIterator(magick_list); 1466 1469 p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); … … 1472 1475 } 1473 1476 status=DeleteNodeByValueFromSplayTree(magick_list,p); 1474 RelinquishSemaphoreInfo(magick_semaphore);1477 UnlockSemaphoreInfo(magick_semaphore); 1475 1478 return(status); 1476 1479 } -
ImageMagick/trunk/magick/memory.c
r363 r453 392 392 if (free_segments == (DataSegmentInfo *) NULL) 393 393 { 394 AcquireSemaphoreInfo(&memory_semaphore);394 LockSemaphoreInfo(memory_semaphore); 395 395 if (free_segments == (DataSegmentInfo *) NULL) 396 396 { … … 412 412 free_segments=(&memory_info.segment_pool[0]); 413 413 } 414 RelinquishSemaphoreInfo(memory_semaphore);415 } 416 AcquireSemaphoreInfo(&memory_semaphore);414 UnlockSemaphoreInfo(memory_semaphore); 415 } 416 LockSemaphoreInfo(memory_semaphore); 417 417 memory=AcquireBlock(size == 0 ? 1UL : size); 418 418 if (memory == (void *) NULL) … … 421 421 memory=AcquireBlock(size == 0 ? 1UL : size); 422 422 } 423 RelinquishSemaphoreInfo(memory_semaphore);423 UnlockSemaphoreInfo(memory_semaphore); 424 424 #endif 425 425 return(memory); … … 547 547 i; 548 548 549 AcquireSemaphoreInfo(&memory_semaphore);550 RelinquishSemaphoreInfo(memory_semaphore);549 LockSemaphoreInfo(memory_semaphore); 550 UnlockSemaphoreInfo(memory_semaphore); 551 551 for (i=0; i < (long) memory_info.number_segments; i++) 552 552 if (memory_info.segments[i]->mapped == MagickFalse) … … 743 743 assert((SizeOfBlock(memory) % (4*sizeof(size_t))) == 0); 744 744 assert((*BlockHeader(NextBlock(memory)) & PreviousBlockBit) != 0); 745 AcquireSemaphoreInfo(&memory_semaphore);745 LockSemaphoreInfo(memory_semaphore); 746 746 if ((*BlockHeader(memory) & PreviousBlockBit) == 0) 747 747 { … … 774 774 *BlockHeader(NextBlock(memory))&=(~PreviousBlockBit); 775 775 InsertFreeBlock(memory,AllocationPolicy(SizeOfBlock(memory))); 776 RelinquishSemaphoreInfo(memory_semaphore);776 UnlockSemaphoreInfo(memory_semaphore); 777 777 #endif 778 778 return((void *) NULL); … … 871 871 memory=RelinquishMagickMemory(memory); 872 872 #else 873 AcquireSemaphoreInfo(&memory_semaphore);873 LockSemaphoreInfo(memory_semaphore); 874 874 block=ResizeBlock(memory,size == 0 ? 1UL : size); 875 875 if (block == (void *) NULL) … … 877 877 if (ExpandHeap(size == 0 ? 1UL : size) == MagickFalse) 878 878 { 879 RelinquishSemaphoreInfo(memory_semaphore);879 UnlockSemaphoreInfo(memory_semaphore); 880 880 memory=RelinquishMagickMemory(memory); 881 881 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); … … 884 884 assert(block != (void *) NULL); 885 885 } 886 RelinquishSemaphoreInfo(memory_semaphore);886 UnlockSemaphoreInfo(memory_semaphore); 887 887 memory=RelinquishMagickMemory(memory); 888 888 #endif -
ImageMagick/trunk/magick/mime.c
r446 r453 201 201 mime_info=(const MimeInfo *) NULL; 202 202 lsb_first=1; 203 AcquireSemaphoreInfo(&mime_semaphore);203 LockSemaphoreInfo(mime_semaphore); 204 204 ResetLinkedListIterator(mime_list); 205 205 p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); … … 325 325 (void) InsertValueInLinkedList(mime_list,0, 326 326 RemoveElementByValueFromLinkedList(mime_list,p)); 327 RelinquishSemaphoreInfo(mime_semaphore);327 UnlockSemaphoreInfo(mime_semaphore); 328 328 return(mime_info); 329 329 } … … 409 409 Generate mime list. 410 410 */ 411 AcquireSemaphoreInfo(&mime_semaphore);411 LockSemaphoreInfo(mime_semaphore); 412 412 ResetLinkedListIterator(mime_list); 413 413 p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); … … 419 419 p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); 420 420 } 421 RelinquishSemaphoreInfo(mime_semaphore);421 UnlockSemaphoreInfo(mime_semaphore); 422 422 qsort((void *) aliases,(size_t) i,sizeof(*aliases),MimeInfoCompare); 423 423 aliases[i]=(MimeInfo *) NULL; … … 501 501 if (aliases == (char **) NULL) 502 502 return((char **) NULL); 503 AcquireSemaphoreInfo(&mime_semaphore);503 LockSemaphoreInfo(mime_semaphore); 504 504 ResetLinkedListIterator(mime_list); 505 505 p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); … … 511 511 p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); 512 512 } 513 RelinquishSemaphoreInfo(mime_semaphore);513 UnlockSemaphoreInfo(mime_semaphore); 514 514 qsort((void *) aliases,(size_t) i,sizeof(*aliases),MimeCompare); 515 515 aliases[i]=(char *) NULL; … … 606 606 { 607 607 AcquireSemaphoreInfo(&mime_semaphore); 608 LockSemaphoreInfo(mime_semaphore); 608 609 if ((mime_list == (LinkedListInfo *) NULL) && 609 610 (instantiate_mime == MagickFalse)) … … 612 613 instantiate_mime=MagickTrue; 613 614 } 614 RelinquishSemaphoreInfo(mime_semaphore);615 UnlockSemaphoreInfo(mime_semaphore); 615 616 } 616 617 return(mime_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse); … … 1051 1052 MagickExport MagickBooleanType MimeComponentGenesis(void) 1052 1053 { 1053 AcquireSemaphoreInfo(&mime_semaphore);1054 RelinquishSemaphoreInfo(mime_semaphore);1054 assert(mime_semaphore == (SemaphoreInfo *) NULL); 1055 mime_semaphore=AllocateSemaphoreInfo(); 1055 1056 return(MagickTrue); 1056 1057 } … … 1097 1098 MagickExport void MimeComponentTerminus(void) 1098 1099 { 1099 AcquireSemaphoreInfo(&mime_semaphore); 1100 if (mime_semaphore == (SemaphoreInfo *) NULL) 1101 AcquireSemaphoreInfo(&mime_semaphore); 1102 LockSemaphoreInfo(mime_semaphore); 1100 1103 if (mime_list != (LinkedListInfo *) NULL) 1101 1104 mime_list=DestroyLinkedList(mime_list,DestroyMimeElement); 1102 1105 instantiate_mime=MagickFalse; 1103 RelinquishSemaphoreInfo(mime_semaphore);1106 UnlockSemaphoreInfo(mime_semaphore); 1104 1107 DestroySemaphoreInfo(&mime_semaphore); 1105 1108 } -
ImageMagick/trunk/magick/module.c
r446 r453 176 176 Destroy magick modules. 177 177 */ 178 AcquireSemaphoreInfo(&module_semaphore);178 LockSemaphoreInfo(module_semaphore); 179 179 #if defined(MAGICKCORE_MODULES_SUPPORT) 180 180 if (module_list != (SplayTreeInfo *) NULL) … … 184 184 #endif 185 185 instantiate_module=MagickFalse; 186 RelinquishSemaphoreInfo(module_semaphore);186 UnlockSemaphoreInfo(module_semaphore); 187 187 } 188 188 … … 233 233 (void) OpenModules(exception); 234 234 #endif 235 AcquireSemaphoreInfo(&module_semaphore);235 LockSemaphoreInfo(module_semaphore); 236 236 ResetSplayTreeIterator(module_list); 237 237 p=(ModuleInfo *) GetNextValueInSplayTree(module_list); 238 RelinquishSemaphoreInfo(module_semaphore);238 UnlockSemaphoreInfo(module_semaphore); 239 239 return(p); 240 240 } … … 320 320 Generate module list. 321 321 */ 322 AcquireSemaphoreInfo(&module_semaphore);322 LockSemaphoreInfo(module_semaphore); 323 323 ResetSplayTreeIterator(module_list); 324 324 p=(const ModuleInfo *) GetNextValueInSplayTree(module_list); … … 330 330 p=(const ModuleInfo *) GetNextValueInSplayTree(module_list); 331 331 } 332 RelinquishSemaphoreInfo(module_semaphore);332 UnlockSemaphoreInfo(module_semaphore); 333 333 qsort((void *) modules,(size_t) i,sizeof(*modules),ModuleInfoCompare); 334 334 modules[i]=(ModuleInfo *) NULL; … … 849 849 { 850 850 AcquireSemaphoreInfo(&module_semaphore); 851 LockSemaphoreInfo(module_semaphore); 851 852 if ((module_list == (SplayTreeInfo *) NULL) && 852 853 (instantiate_module == MagickFalse)) … … 874 875 instantiate_module=MagickTrue; 875 876 } 876 RelinquishSemaphoreInfo(module_semaphore);877 UnlockSemaphoreInfo(module_semaphore); 877 878 } 878 879 return(module_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse); … … 1106 1107 *exception; 1107 1108 1109 assert(module_semaphore == (SemaphoreInfo *) NULL); 1110 module_semaphore=AllocateSemaphoreInfo(); 1108 1111 exception=AcquireExceptionInfo(); 1109 1112 InitializeModuleList(exception); … … 1132 1135 MagickExport void ModuleComponentTerminus(void) 1133 1136 { 1137 if (module_semaphore == (SemaphoreInfo *) NULL) 1138 AcquireSemaphoreInfo(&module_semaphore); 1134 1139 DestroyModuleList(); 1135 1140 DestroySemaphoreInfo(&module_semaphore); -
ImageMagick/trunk/magick/policy.c
r446 r453 193 193 Search for policy tag. 194 194 */ 195 AcquireSemaphoreInfo(&policy_semaphore);195 LockSemaphoreInfo(policy_semaphore); 196 196 ResetLinkedListIterator(policy_list); 197 197 p=(PolicyInfo *) GetNextValueInLinkedList(policy_list); … … 208 208 (void) InsertValueInLinkedList(policy_list,0, 209 209 RemoveElementByValueFromLinkedList(policy_list,p)); 210 RelinquishSemaphoreInfo(policy_semaphore);210 UnlockSemaphoreInfo(policy_semaphore); 211 211 return(p); 212 212 } … … 268 268 Generate policy list. 269 269 */ 270 AcquireSemaphoreInfo(&policy_semaphore);270 LockSemaphoreInfo(policy_semaphore); 271 271 ResetLinkedListIterator(policy_list); 272 272 p=(const PolicyInfo *) GetNextValueInLinkedList(policy_list); … … 278 278 p=(const PolicyInfo *) GetNextValueInLinkedList(policy_list); 279 279 } 280 RelinquishSemaphoreInfo(policy_semaphore);280 UnlockSemaphoreInfo(policy_semaphore); 281 281 policies[i]=(PolicyInfo *) NULL; 282 282 *number_policies=(unsigned long) i; … … 340 340 Generate policy list. 341 341 */ 342 AcquireSemaphoreInfo(&policy_semaphore);342 LockSemaphoreInfo(policy_semaphore); 343 343 ResetLinkedListIterator(policy_list); 344 344 p=(const PolicyInfo *) GetNextValueInLinkedList(policy_list); … … 350 350 p=(const PolicyInfo *) GetNextValueInLinkedList(policy_list); 351 351 } 352 RelinquishSemaphoreInfo(policy_semaphore);352 UnlockSemaphoreInfo(policy_semaphore); 353 353 policies[i]=(char *) NULL; 354 354 *number_policies=(unsigned long) i; … … 430 430 { 431 431 AcquireSemaphoreInfo(&policy_semaphore); 432 LockSemaphoreInfo(policy_semaphore); 432 433 if ((policy_list == (LinkedListInfo *) NULL) && 433 434 (instantiate_policy == MagickFalse)) … … 436 437 instantiate_policy=MagickTrue; 437 438 } 438 RelinquishSemaphoreInfo(policy_semaphore);439 UnlockSemaphoreInfo(policy_semaphore); 439 440 } 440 441 return(policy_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse); … … 494 495 return(MagickTrue); 495 496 authorized=MagickTrue; 496 AcquireSemaphoreInfo(&policy_semaphore);497 LockSemaphoreInfo(policy_semaphore); 497 498 ResetLinkedListIterator(policy_list); 498 499 p=(PolicyInfo *) GetNextValueInLinkedList(policy_list); … … 514 515 p=(PolicyInfo *) GetNextValueInLinkedList(policy_list); 515 516 } 516 RelinquishSemaphoreInfo(policy_semaphore);517 UnlockSemaphoreInfo(policy_semaphore); 517 518 return(authorized); 518 519 } … … 965 966 MagickExport MagickBooleanType PolicyComponentGenesis(void) 966 967 { 967 AcquireSemaphoreInfo(&policy_semaphore);968 RelinquishSemaphoreInfo(policy_semaphore);968 assert(policy_semaphore == (SemaphoreInfo *) NULL); 969 policy_semaphore=AllocateSemaphoreInfo(); 969 970 return(MagickTrue); 970 971 } … … 1012 1013 MagickExport void PolicyComponentTerminus(void) 1013 1014 { 1014 AcquireSemaphoreInfo(&policy_semaphore); 1015 if (policy_semaphore == (SemaphoreInfo *) NULL) 1016 AcquireSemaphoreInfo(&policy_semaphore); 1017 LockSemaphoreInfo(policy_semaphore); 1015 1018 if (policy_list != (LinkedListInfo *) NULL) 1016 1019 policy_list=DestroyLinkedList(policy_list,DestroyPolicyElement); 1017 1020 instantiate_policy=MagickFalse; 1018 RelinquishSemaphoreInfo(policy_semaphore);1021 UnlockSemaphoreInfo(policy_semaphore); 1019 1022 DestroySemaphoreInfo(&policy_semaphore); 1020 1023 } -
ImageMagick/trunk/magick/random.c
r446 r453 690 690 % % 691 691 % % 692 + R a n d o m C o m p o n e n t G e n e s i s %692 + R a n d o m C o m p o n e n t G e n e s i s % 693 693 % % 694 694 % % … … 705 705 MagickExport MagickBooleanType RandomComponentGenesis(void) 706 706 { 707 AcquireSemaphoreInfo(&random_semaphore);708 RelinquishSemaphoreInfo(random_semaphore);707 assert(random_semaphore == (SemaphoreInfo *) NULL); 708 random_semaphore=AllocateSemaphoreInfo(); 709 709 return(MagickTrue); 710 710 } … … 730 730 MagickExport void RandomComponentTerminus(void) 731 731 { 732 AcquireSemaphoreInfo(&random_semaphore);733 (void) UnlockSemaphoreInfo(random_semaphore);732 if (random_semaphore == (SemaphoreInfo *) NULL) 733 AcquireSemaphoreInfo(&random_semaphore); 734 734 DestroySemaphoreInfo(&random_semaphore); 735 735 } -
ImageMagick/trunk/magick/registry.c
r446 r453 300 300 MagickExport MagickBooleanType RegistryComponentGenesis(void) 301 301 { 302 AcquireSemaphoreInfo(®istry_semaphore);303 RelinquishSemaphoreInfo(registry_semaphore);302 assert(registry_semaphore == (SemaphoreInfo *) NULL); 303 registry_semaphore=AllocateSemaphoreInfo(); 304 304 return(MagickTrue); 305 305 } … … 325 325 MagickExport void RegistryComponentTerminus(void) 326 326 { 327 AcquireSemaphoreInfo(®istry_semaphore); 327 if (registry_semaphore == (SemaphoreInfo *) NULL) 328 AcquireSemaphoreInfo(®istry_semaphore); 329 LockSemaphoreInfo(registry_semaphore); 328 330 if (IsEventLogging() != MagickFalse) 329 331 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); … … 331 333 registry=DestroySplayTree(registry); 332 334 instantiate_registry=MagickFalse; 333 RelinquishSemaphoreInfo(registry_semaphore);335 UnlockSemaphoreInfo(registry_semaphore); 334 336 DestroySemaphoreInfo(®istry_semaphore); 335 337 } … … 525 527 { 526 528 AcquireSemaphoreInfo(®istry_semaphore); 529 LockSemaphoreInfo(registry_semaphore); 527 530 if ((registry == (SplayTreeInfo *) NULL) && 528 531 (instantiate_registry == MagickFalse)) … … 532 535 instantiate_registry=MagickTrue; 533 536 } 534 RelinquishSemaphoreInfo(registry_semaphore);537 UnlockSemaphoreInfo(registry_semaphore); 535 538 } 536 539 status=AddValueToSplayTree(registry,ConstantString(key),registry_info); -
ImageMagick/trunk/magick/resource.c
r446 r453 160 160 status=MagickFalse; 161 161 (void) FormatMagickSize(size,resource_request); 162 AcquireSemaphoreInfo(&resource_semaphore); 162 if (resource_semaphore == (SemaphoreInfo *) NULL) 163 AcquireSemaphoreInfo(&resource_semaphore); 164 LockSemaphoreInfo(resource_semaphore); 163 165 switch (type) 164 166 { … … 254 256 break; 255 257 } 256 RelinquishSemaphoreInfo(resource_semaphore);258 UnlockSemaphoreInfo(resource_semaphore); 257 259 (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s: %s/%s/%s", 258 260 MagickOptionToMnemonic(MagickResourceOptions,(long) type),resource_request, … … 468 470 if (file == -1) 469 471 return(file); 470 AcquireSemaphoreInfo(&resource_semaphore); 472 if (resource_semaphore == (SemaphoreInfo *) NULL) 473 AcquireSemaphoreInfo(&resource_semaphore); 474 LockSemaphoreInfo(resource_semaphore); 471 475 if (temporary_resources == (SplayTreeInfo *) NULL) 472 476 temporary_resources=NewSplayTree(CompareSplayTreeString, 473 477 RelinquishMagickMemory,DestroyTemporaryResources); 474 RelinquishSemaphoreInfo(resource_semaphore);478 UnlockSemaphoreInfo(resource_semaphore); 475 479 resource=ConstantString(path); 476 480 (void) AddValueToSplayTree(temporary_resources,resource,resource); … … 506 510 507 511 resource=0; 508 AcquireSemaphoreInfo(&resource_semaphore);512 LockSemaphoreInfo(resource_semaphore); 509 513 switch (type) 510 514 { … … 547 551 break; 548 552 } 549 RelinquishSemaphoreInfo(resource_semaphore);553 UnlockSemaphoreInfo(resource_semaphore); 550 554 return(resource); 551 555 } … … 579 583 580 584 resource=0; 581 AcquireSemaphoreInfo(&resource_semaphore); 585 if (resource_semaphore == (SemaphoreInfo *) NULL) 586 AcquireSemaphoreInfo(&resource_semaphore); 587 LockSemaphoreInfo(resource_semaphore); 582 588 switch (type) 583 589 { … … 620 626 break; 621 627 } 622 RelinquishSemaphoreInfo(resource_semaphore);628 UnlockSemaphoreInfo(resource_semaphore); 623 629 return(resource); 624 630 } … … 661 667 if (file == (const FILE *) NULL) 662 668 file=stdout; 663 AcquireSemaphoreInfo(&resource_semaphore); 669 if (resource_semaphore == (SemaphoreInfo *) NULL) 670 AcquireSemaphoreInfo(&resource_semaphore); 671 LockSemaphoreInfo(resource_semaphore); 664 672 (void) FormatMagickSize(resource_info.area_limit,area_limit); 665 673 (void) FormatMagickSize(resource_info.memory_limit,memory_limit); … … 678 686 disk_limit,(unsigned long) resource_info.thread_limit,time_limit); 679 687 (void) fflush(file); 680 RelinquishSemaphoreInfo(resource_semaphore);688 UnlockSemaphoreInfo(resource_semaphore); 681 689 return(MagickTrue); 682 690 } … … 716 724 717 725 (void) FormatMagickSize(size,resource_request); 718 AcquireSemaphoreInfo(&resource_semaphore); 726 if (resource_semaphore == (SemaphoreInfo *) NULL) 727 AcquireSemaphoreInfo(&resource_semaphore); 728 LockSemaphoreInfo(resource_semaphore); 719 729 switch (type) 720 730 { … … 781 791 break; 782 792 } 783 RelinquishSemaphoreInfo(resource_semaphore);793 UnlockSemaphoreInfo(resource_semaphore); 784 794 (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s: %s/%s/%s", 785 795 MagickOptionToMnemonic(MagickResourceOptions,(long) type),resource_request, … … 893 903 Set Magick resource limits. 894 904 */ 895 AcquireSemaphoreInfo(&resource_semaphore);896 RelinquishSemaphoreInfo(resource_semaphore);905 assert(resource_semaphore == (SemaphoreInfo *) NULL); 906 resource_semaphore=AllocateSemaphoreInfo(); 897 907 pagesize=GetMagickPageSize(); 898 908 pages=(-1); … … 1014 1024 MagickExport void ResourceComponentTerminus(void) 1015 1025 { 1016 AcquireSemaphoreInfo(&resource_semaphore); 1026 if (resource_semaphore == (SemaphoreInfo *) NULL) 1027 AcquireSemaphoreInfo(&resource_semaphore); 1028 LockSemaphoreInfo(resource_semaphore); 1017 1029 if (temporary_resources != (SplayTreeInfo *) NULL) 1018 1030 temporary_resources=DestroySplayTree(temporary_resources); 1019 1031 if (random_info != (RandomInfo *) NULL) 1020 1032 random_info=DestroyRandomInfo(random_info); 1021 RelinquishSemaphoreInfo(resource_semaphore);1033 UnlockSemaphoreInfo(resource_semaphore); 1022 1034 DestroySemaphoreInfo(&resource_semaphore); 1023 1035 } … … 1051 1063 const MagickSizeType limit) 1052 1064 { 1053 AcquireSemaphoreInfo(&resource_semaphore); 1065 if (resource_semaphore == (SemaphoreInfo *) NULL) 1066 AcquireSemaphoreInfo(&resource_semaphore); 1067 LockSemaphoreInfo(resource_semaphore); 1054 1068 switch (type) 1055 1069 { … … 1093 1107 break; 1094 1108 } 1095 RelinquishSemaphoreInfo(resource_semaphore);1109 UnlockSemaphoreInfo(resource_semaphore); 1096 1110 return(MagickTrue); 1097 1111 } -
ImageMagick/trunk/magick/semaphore.c
r446 r453 119 119 *semaphore_info=AllocateSemaphoreInfo(); 120 120 UnlockMagickMutex(); 121 (void) LockSemaphoreInfo(*semaphore_info);122 121 } 123 122 -
ImageMagick/trunk/magick/type.c
r446 r453 271 271 if (type_list == (SplayTreeInfo *) NULL) 272 272 return((TypeInfo *) NULL); 273 AcquireSemaphoreInfo(&type_semaphore);273 LockSemaphoreInfo(type_semaphore); 274 274 ResetSplayTreeIterator(type_list); 275 275 type_info=(const TypeInfo *) NULL; … … 316 316 break; 317 317 } 318 RelinquishSemaphoreInfo(type_semaphore);318 UnlockSemaphoreInfo(type_semaphore); 319 319 if (type_info != (const TypeInfo *) NULL) 320 320 return(type_info); … … 323 323 */ 324 324 max_score=0; 325 AcquireSemaphoreInfo(&type_semaphore);325 LockSemaphoreInfo(type_semaphore); 326 326 ResetSplayTreeIterator(type_list); 327 327 p=(const TypeInfo *) GetNextValueInSplayTree(type_list); … … 375 375 p=(const TypeInfo *) GetNextValueInSplayTree(type_list); 376 376 } 377 RelinquishSemaphoreInfo(type_semaphore);377 UnlockSemaphoreInfo(type_semaphore); 378 378 if (type_info != (const TypeInfo *) NULL) 379 379 return(type_info); … … 486 486 Generate type list. 487 487 */ 488 AcquireSemaphoreInfo(&type_semaphore);488 LockSemaphoreInfo(type_semaphore); 489 489 ResetSplayTreeIterator(type_list); 490 490 p=(const TypeInfo *) GetNextValueInSplayTree(type_list); … … 496 496 p=(const TypeInfo *) GetNextValueInSplayTree(type_list); 497 497 } 498 RelinquishSemaphoreInfo(type_semaphore);498 UnlockSemaphoreInfo(type_semaphore); 499 499 qsort((void *) fonts,(size_t) i,sizeof(*fonts),TypeInfoCompare); 500 500 fonts[i]=(TypeInfo *) NULL; … … 579 579 Generate type list. 580 580 */ 581 AcquireSemaphoreInfo(&type_semaphore);581 LockSemaphoreInfo(type_semaphore); 582 582 ResetSplayTreeIterator(type_list); 583 583 p=(const TypeInfo *) GetNextValueInSplayTree(type_list); … … 589 589 p=(const TypeInfo *) GetNextValueInSplayTree(type_list); 590 590 } 591 RelinquishSemaphoreInfo(type_semaphore);591 UnlockSemaphoreInfo(type_semaphore); 592 592 qsort((void *) fonts,(size_t) i,sizeof(*fonts),TypeCompare); 593 593 fonts[i]=(char *) NULL; … … 773 773 { 774 774 AcquireSemaphoreInfo(&type_semaphore); 775 LockSemaphoreInfo(type_semaphore); 775 776 if ((type_list == (SplayTreeInfo *) NULL) && 776 777 (instantiate_type == MagickFalse)) … … 785 786 instantiate_type=MagickTrue; 786 787 } 787 RelinquishSemaphoreInfo(type_semaphore);788 UnlockSemaphoreInfo(type_semaphore); 788 789 } 789 790 return(type_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse); … … 1343 1344 MagickExport MagickBooleanType TypeComponentGenesis(void) 1344 1345 { 1345 AcquireSemaphoreInfo(&type_semaphore);1346 RelinquishSemaphoreInfo(type_semaphore);1346 assert(type_semaphore == (SemaphoreInfo *) NULL); 1347 type_semaphore=AllocateSemaphoreInfo(); 1347 1348 return(MagickTrue); 1348 1349 } … … 1368 1369 MagickExport void TypeComponentTerminus(void) 1369 1370 { 1370 AcquireSemaphoreInfo(&type_semaphore); 1371 if (type_semaphore == (SemaphoreInfo *) NULL) 1372 AcquireSemaphoreInfo(&type_semaphore); 1373 LockSemaphoreInfo(type_semaphore); 1371 1374 if (type_list != (SplayTreeInfo *) NULL) 1372 1375 type_list=DestroySplayTree(type_list); 1373 1376 instantiate_type=MagickFalse; 1374 RelinquishSemaphoreInfo(type_semaphore);1377 UnlockSemaphoreInfo(type_semaphore); 1375 1378 DestroySemaphoreInfo(&type_semaphore); 1376 1379 } -
ImageMagick/trunk/wand/wand.c
r1 r453 77 77 id = 0; 78 78 79 AcquireSemaphoreInfo(&wand_semaphore); 79 if (wand_semaphore == (SemaphoreInfo *) NULL) 80 AcquireSemaphoreInfo(&wand_semaphore); 81 LockSemaphoreInfo(wand_semaphore); 80 82 if ((wand_ids == (SplayTreeInfo *) NULL) && (instantiate_wand == MagickFalse)) 81 83 { … … 86 88 id++; 87 89 (void) AddValueToSplayTree(wand_ids,(const void *) id,(const void *) id); 88 RelinquishSemaphoreInfo(wand_semaphore);90 UnlockSemaphoreInfo(wand_semaphore); 89 91 return(id); 90 92 } … … 112 114 WandExport void DestroyWandIds(void) 113 115 { 114 AcquireSemaphoreInfo(&wand_semaphore);116 LockSemaphoreInfo(wand_semaphore); 115 117 if (wand_ids != (SplayTreeInfo *) NULL) 116 118 wand_ids=DestroySplayTree(wand_ids); 117 119 instantiate_wand=MagickFalse; 118 RelinquishSemaphoreInfo(wand_semaphore);120 UnlockSemaphoreInfo(wand_semaphore); 119 121 DestroySemaphoreInfo(&wand_semaphore); 120 122 } … … 144 146 WandExport void RelinquishWandId(const unsigned long id) 145 147 { 146 AcquireSemaphoreInfo(&wand_semaphore);148 LockSemaphoreInfo(wand_semaphore); 147 149 if (wand_ids != (SplayTreeInfo *) NULL) 148 150 (void) DeleteNodeByValueFromSplayTree(wand_ids,(const void *) id); 149 RelinquishSemaphoreInfo(wand_semaphore);151 UnlockSemaphoreInfo(wand_semaphore); 150 152 }
