libidav/config.c

changeset 837
b5984d5cc40c
parent 836
7842c7665cd0
child 838
d262210f8454
equal deleted inserted replaced
836:7842c7665cd0 837:b5984d5cc40c
140 xmlAddChild(parent, cbool->node); 140 xmlAddChild(parent, cbool->node);
141 } 141 }
142 set_xml_content(cbool->node, content); 142 set_xml_content(cbool->node, content);
143 } 143 }
144 144
145 void dav_cfg_int_set_value(DavConfig *config, CfgInt *cint, xmlNode *parent, int64_t new_value, const char *nodename) {
146 char content[32];
147 snprintf(content, 32, "%" PRId64, new_value);
148 cint->value = new_value;
149 if(!cint->node) {
150 cint->node = xmlNewNode(NULL, (const xmlChar*) nodename);
151 xmlAddChild(parent, cint->node);
152 }
153 set_xml_content(cint->node, content);
154 }
155
156 void dav_cfg_uint_set_value(DavConfig *config, CfgUInt *cint, xmlNode *parent, uint64_t new_value, const char *nodename) {
157 char content[32];
158 snprintf(content, 32, "%" PRIu64, new_value);
159 cint->value = new_value;
160 if(!cint->node) {
161 cint->node = xmlNewNode(NULL, (const xmlChar*) nodename);
162 xmlAddChild(parent, cint->node);
163 }
164 set_xml_content(cint->node, content);
165 }
166
145 void dav_cfg_string_remove(CfgString *str) { 167 void dav_cfg_string_remove(CfgString *str) {
146 if(str->node) { 168 if(str->node) {
147 xmlUnlinkNode(str->node); 169 xmlUnlinkNode(str->node);
148 xmlFreeNode(str->node); 170 xmlFreeNode(str->node);
149 str->node = NULL; 171 str->node = NULL;
153 void dav_cfg_bool_remove(CfgBool *cbool) { 175 void dav_cfg_bool_remove(CfgBool *cbool) {
154 if(cbool->node) { 176 if(cbool->node) {
155 xmlUnlinkNode(cbool->node); 177 xmlUnlinkNode(cbool->node);
156 xmlFreeNode(cbool->node); 178 xmlFreeNode(cbool->node);
157 cbool->node = NULL; 179 cbool->node = NULL;
180 }
181 }
182
183 void dav_cfg_int_remove(CfgInt *cint) {
184 if(cint->node) {
185 xmlUnlinkNode(cint->node);
186 xmlFreeNode(cint->node);
187 cint->node = NULL;
188 }
189 }
190
191 void dav_cfg_uint_remove(CfgUInt *cint) {
192 if(cint->node) {
193 xmlUnlinkNode(cint->node);
194 xmlFreeNode(cint->node);
195 cint->node = NULL;
158 } 196 }
159 } 197 }
160 198
161 199
162 DavConfig* dav_config_new(xmlDoc *doc) { 200 DavConfig* dav_config_new(xmlDoc *doc) {

mercurial