root/win32/globals.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. php_win32_core_globals_ctor
  2. php_win32_core_globals_dtor
  3. PHP_RSHUTDOWN_FUNCTION

   1 /*
   2    +----------------------------------------------------------------------+
   3    | PHP Version 7                                                        |
   4    +----------------------------------------------------------------------+
   5    | Copyright (c) 1997-2016 The PHP Group                                |
   6    +----------------------------------------------------------------------+
   7    | This source file is subject to version 3.01 of the PHP license,      |
   8    | that is bundled with this package in the file LICENSE, and is        |
   9    | available through the world-wide-web at the following url:           |
  10    | http://www.php.net/license/3_01.txt                                  |
  11    | If you did not receive a copy of the PHP license and are unable to   |
  12    | obtain it through the world-wide-web, please send a note to          |
  13    | license@php.net so we can mail you a copy immediately.               |
  14    +----------------------------------------------------------------------+
  15    | Author: Wez Furlong <wez@php.net>                                    |
  16    +----------------------------------------------------------------------+
  17 */
  18 
  19 /* $Id$ */
  20 
  21 #include "php.h"
  22 #include "php_win32_globals.h"
  23 #include "syslog.h"
  24 
  25 #ifdef ZTS
  26 PHPAPI int php_win32_core_globals_id;
  27 #else
  28 php_win32_core_globals the_php_win32_core_globals;
  29 #endif
  30 
  31 void php_win32_core_globals_ctor(void *vg)
  32 {
  33         php_win32_core_globals *wg = (php_win32_core_globals*)vg;
  34         memset(wg, 0, sizeof(*wg));
  35 
  36         wg->mail_socket = INVALID_SOCKET;
  37 
  38         wg->log_source = INVALID_HANDLE_VALUE;
  39 }
  40 
  41 void php_win32_core_globals_dtor(void *vg)
  42 {
  43         php_win32_core_globals *wg = (php_win32_core_globals*)vg;
  44 
  45         if (wg->registry_key) {
  46                 RegCloseKey(wg->registry_key);
  47                 wg->registry_key = NULL;
  48         }
  49         if (wg->registry_event) {
  50                 CloseHandle(wg->registry_event);
  51                 wg->registry_event = NULL;
  52         }
  53         if (wg->registry_directories) {
  54                 zend_hash_destroy(wg->registry_directories);
  55                 free(wg->registry_directories);
  56                 wg->registry_directories = NULL;
  57         }
  58 
  59         if (INVALID_SOCKET != wg->mail_socket) {
  60                 closesocket(wg->mail_socket);
  61                 wg->mail_socket = INVALID_SOCKET;
  62         }
  63 }
  64 
  65 
  66 PHP_RSHUTDOWN_FUNCTION(win32_core_globals)
  67 {
  68         php_win32_core_globals *wg =
  69 #ifdef ZTS
  70                 ts_resource(php_win32_core_globals_id)
  71 #else
  72                 &the_php_win32_core_globals
  73 #endif
  74                 ;
  75 
  76         closelog();
  77 
  78         return SUCCESS;
  79 }
  80 
  81 /*
  82  * Local variables:
  83  * tab-width: 4
  84  * c-basic-offset: 4
  85  * End:
  86  * vim600: sw=4 ts=4 fdm=marker
  87  * vim<600: sw=4 ts=4
  88  */

/* [<][>][^][v][top][bottom][index][help] */