Back to index

php5  5.3.10
globals.c
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Author: Wez Furlong <wez@php.net>                                    |
00016    +----------------------------------------------------------------------+
00017 */
00018 
00019 /* $Id: globals.c 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #include "php.h"
00022 #include "php_win32_globals.h"
00023 #include "syslog.h"
00024 
00025 #ifdef ZTS
00026 PHPAPI int php_win32_core_globals_id;
00027 #else
00028 php_win32_core_globals the_php_win32_core_globals;
00029 #endif
00030 
00031 void php_win32_core_globals_ctor(void *vg TSRMLS_DC)
00032 {
00033        php_win32_core_globals *wg = (php_win32_core_globals*)vg;
00034        memset(wg, 0, sizeof(*wg));
00035 }
00036 
00037 void php_win32_core_globals_dtor(void *vg TSRMLS_DC)
00038 {
00039        php_win32_core_globals *wg = (php_win32_core_globals*)vg;
00040 
00041        if (wg->registry_key) {
00042               RegCloseKey(wg->registry_key);
00043               wg->registry_key = NULL;
00044        }
00045        if (wg->registry_event) {
00046               CloseHandle(wg->registry_event);
00047               wg->registry_event = NULL;
00048        }
00049        if (wg->registry_directories) {
00050               zend_hash_destroy(wg->registry_directories);
00051               free(wg->registry_directories);
00052               wg->registry_directories = NULL;
00053        }
00054 }
00055 
00056 
00057 PHP_RSHUTDOWN_FUNCTION(win32_core_globals)
00058 {
00059        php_win32_core_globals *wg =
00060 #ifdef ZTS
00061               ts_resource(php_win32_core_globals_id)
00062 #else
00063               &the_php_win32_core_globals
00064 #endif
00065               ;
00066 
00067        closelog();
00068        wg->starttime.tv_sec = 0;
00069        wg->lasttime = 0;
00070 
00071        return SUCCESS;
00072 }
00073