summaryrefslogtreecommitdiff
path: root/zend/ini.cpp
blob: 889e3881e08c7f5f40921c45faf3dcad827408ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
 *  Ini.cpp
 *
 *  Implementation for ....
 *
 *  @copyright 2013 Copernica BV
 */
#include "includes.h"

/**
 *  Set up namespace
 */
namespace Php {

/**
 *  Filling ini_entries
 *  @param  zend_ini_entry *ini_entry, int module_number
 *  @param  int module_number
 */
void Ini::fill(zend_ini_entry *ini_entry, int module_number)
{
    ini_entry->module_number     = module_number;
    ini_entry->modifiable        = static_cast<int>(this->_place);
    ini_entry->name              = const_cast<char*>(this->_name.c_str());
    ini_entry->name_length       = this->_name.size()+1;
    ini_entry->on_modify         = OnUpdateString;
    ini_entry->mh_arg1           = nullptr;
    #ifdef ZTS
        ini_entry->mh_arg2       = (void *) &phpcpp_globals_id;
    #else
        ini_entry->mh_arg2       = (void *) &phpcpp_globals;
    #endif
    ini_entry->mh_arg3           = nullptr;
    ini_entry->value             = const_cast<char*>(this->_value.c_str());
    ini_entry->value_length      = this->_value.size();
    if( this->_orig_empty) 
    {
        ini_entry->orig_value     = nullptr;
        ini_entry->orig_value_length = 0;
    } 
    else 
    {
        ini_entry->orig_value     = const_cast<char*>(this->_orig.c_str());
        ini_entry->orig_value_length = this->_orig.size();
    }
    ini_entry->orig_modifiable   = 0;
    ini_entry->modified          = 0;
    ini_entry->displayer         = nullptr;
}


/**
 *  End of namespace
 */
}