|
|
|
|
@ -28,6 +28,7 @@
|
|
|
|
|
|
|
|
|
|
/* For malloc/free and mkdtemp */
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
/* For string handling */
|
|
|
|
|
#include <string.h>
|
|
|
|
|
@ -46,13 +47,6 @@
|
|
|
|
|
#include <sys/syslimits.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef FALSE
|
|
|
|
|
#define FALSE 0
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef TRUE
|
|
|
|
|
#define TRUE 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
|
|
|
|
|
|
|
|
/* Hold on to folder names for cleanup when libr is removed from memory */
|
|
|
|
|
@ -64,7 +58,7 @@ CleanupFolder *folders_to_remove = NULL;
|
|
|
|
|
|
|
|
|
|
/* Hold on to libr handles for cleanup when libr is removed from memory */
|
|
|
|
|
typedef struct CLEANUPHANDLE {
|
|
|
|
|
int internal; /* do not warn the user about cleaning this handle up */
|
|
|
|
|
bool internal; /* do not warn the user about cleaning this handle up */
|
|
|
|
|
libr_file *handle;
|
|
|
|
|
struct CLEANUPHANDLE *next;
|
|
|
|
|
} CleanupHandle;
|
|
|
|
|
@ -100,7 +94,7 @@ void register_handle_cleanup(libr_file *handle)
|
|
|
|
|
CleanupHandle *h = malloc(sizeof(CleanupHandle));
|
|
|
|
|
|
|
|
|
|
h->handle = handle;
|
|
|
|
|
h->internal = FALSE;
|
|
|
|
|
h->internal = false;
|
|
|
|
|
h->next = NULL;
|
|
|
|
|
if(handles_to_remove != NULL)
|
|
|
|
|
{
|
|
|
|
|
@ -119,7 +113,7 @@ void register_handle_cleanup(libr_file *handle)
|
|
|
|
|
void unregister_handle_cleanup(libr_file *handle)
|
|
|
|
|
{
|
|
|
|
|
CleanupHandle *i, *last = NULL;
|
|
|
|
|
int found = FALSE;
|
|
|
|
|
bool found = false;
|
|
|
|
|
|
|
|
|
|
if(handles_to_remove == NULL)
|
|
|
|
|
{
|
|
|
|
|
@ -135,7 +129,7 @@ void unregister_handle_cleanup(libr_file *handle)
|
|
|
|
|
else
|
|
|
|
|
last->next = i->next;
|
|
|
|
|
free(i);
|
|
|
|
|
found = TRUE;
|
|
|
|
|
found = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -148,7 +142,7 @@ void unregister_handle_cleanup(libr_file *handle)
|
|
|
|
|
*/
|
|
|
|
|
void register_internal_handle(libr_file *handle)
|
|
|
|
|
{
|
|
|
|
|
int found = FALSE;
|
|
|
|
|
bool found = false;
|
|
|
|
|
CleanupHandle *i;
|
|
|
|
|
|
|
|
|
|
if(handles_to_remove == NULL)
|
|
|
|
|
@ -160,8 +154,8 @@ void register_internal_handle(libr_file *handle)
|
|
|
|
|
{
|
|
|
|
|
if(i->handle == handle)
|
|
|
|
|
{
|
|
|
|
|
i->internal = TRUE;
|
|
|
|
|
found = TRUE;
|
|
|
|
|
i->internal = true;
|
|
|
|
|
found = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|