/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % R e l i n q u i s h U n i q u e F i l e R e s o u r c e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % RelinquishUniqueFileResource() relinquishes a unique file resource. % % The format of the RelinquishUniqueFileResource() method is: % % MagickBooleanType RelinquishUniqueFileResource(const char *path) % % A description of each parameter follows: % % o name: the name of the temporary resource. % */ MagickExport MagickBooleanType RelinquishUniqueFileResource(const char *path) { char cache_path[MaxTextExtent]; assert(path != (const char *) NULL); (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s",path); if (temporary_resources != (SplayTreeInfo *) NULL) { register char *p; ResetSplayTreeIterator(temporary_resources); p=(char *) GetNextKeyInSplayTree(temporary_resources); while (p != (char *) NULL) { if (LocaleCompare(p,path) == 0) break; p=(char *) GetNextKeyInSplayTree(temporary_resources); } if (p != (char *) NULL) (void) DeleteNodeFromSplayTree(temporary_resources,p); } (void) CopyMagickString(cache_path,path,MaxTextExtent); AppendImageFormat("cache",cache_path); (void) ShredFile(cache_path); return(ShredFile(path)); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % R e l i n q u i s h U n i q u e F i l e R e s o u r c e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % RelinquishUniqueFileResource() relinquishes a unique file resource. % % The format of the RelinquishUniqueFileResource() method is: % % MagickBooleanType RelinquishUniqueFileResource(const char *path) % % A description of each parameter follows: % % o name: the name of the temporary resource. % */ MagickExport MagickBooleanType RelinquishUniqueFileResource(const char *path) { char cache_path[MagickPathExtent]; MagickBooleanType status; assert(path != (const char *) NULL); status=MagickFalse; (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s",path); if (resource_semaphore == (SemaphoreInfo *) NULL) ActivateSemaphoreInfo(&resource_semaphore); LockSemaphoreInfo(resource_semaphore); if (temporary_resources != (SplayTreeInfo *) NULL) status=DeleteNodeFromSplayTree(temporary_resources, (const void *) path); UnlockSemaphoreInfo(resource_semaphore); (void) CopyMagickString(cache_path,path,MagickPathExtent); AppendImageFormat("cache",cache_path); (void) ShredFile(cache_path); if (status == MagickFalse) status=ShredFile(path); return(status); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % + A s y n c h r o n o u s R e s o u r c e C o m p o n e n t T e r m i n u s % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % AsynchronousResourceComponentTerminus() destroys the resource environment. % It differs from ResourceComponentTerminus() in that it can be called from a % asynchronous signal handler. % % The format of the ResourceComponentTerminus() method is: % % ResourceComponentTerminus(void) % */ MagickPrivate void AsynchronousResourceComponentTerminus(void) { const char *path; if (temporary_resources == (SplayTreeInfo *) NULL) return; /* Remove any lingering temporary files. */ ResetSplayTreeIterator(temporary_resources); path=(const char *) GetNextKeyInSplayTree(temporary_resources); while (path != (const char *) NULL) { (void) ShredFile(path); path=(const char *) GetNextKeyInSplayTree(temporary_resources); } }
static void *DestroyTemporaryResources(void *temporary_resource) { (void) ShredFile((char *) temporary_resource); temporary_resource=DestroyString((char *) temporary_resource); return((void *) NULL); }