/*
- * "$Id: globals.c 5294 2006-03-15 21:09:32Z mike $"
+ * "$Id: globals.c 6499 2007-04-30 21:44:43Z mike $"
*
* Global variable access routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 1997-2006 by Easy Software Products, all rights reserved.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
#include "http-private.h"
#include "globals.h"
+#include "debug.h"
#include <stdlib.h>
* Initialize the global data exactly once...
*/
+ DEBUG_printf(("_cupsGlobals(): globals_key_once=%d\n", globals_key_once));
+
pthread_once(&globals_key_once, globals_init);
/*
if ((globals = (_cups_globals_t *)pthread_getspecific(globals_key)) == NULL)
{
+ DEBUG_puts("_cupsGlobals: allocating memory for thread...");
+
/*
* No, allocate memory as set the pointer for the key...
*/
globals = calloc(1, sizeof(_cups_globals_t));
pthread_setspecific(globals_key, globals);
+ DEBUG_printf((" globals=%p\n", globals));
+
/*
* Initialize variables that have non-zero values
*/
globals_init()
{
pthread_key_create(&globals_key, globals_destructor);
+
+ DEBUG_printf(("globals_init(): globals_key=%x(%u)\n", globals_key,
+ globals_key));
}
static void
globals_destructor(void *value) /* I - Data to free */
{
+ int i; /* Looping var */
_cups_globals_t *cg; /* Global data */
+ DEBUG_printf(("globals_destructor(value=%p)\n", value));
+
cg = (_cups_globals_t *)value;
- if (cg->http)
- httpClose(cg->http);
+ httpClose(cg->http);
+
+ for (i = 0; i < 3; i ++)
+ cupsFileClose(cg->stdio_files[i]);
- _cupsStrFlush(cg);
- _cupsLangFlush(cg);
- _cupsCharmapFlush(cg);
+ if (cg->last_status_message)
+ free(cg->last_status_message);
cupsFreeOptions(cg->cupsd_num_settings, cg->cupsd_settings);
/*
- * End of "$Id: globals.c 5294 2006-03-15 21:09:32Z mike $".
+ * End of "$Id: globals.c 6499 2007-04-30 21:44:43Z mike $".
*/