* xmlFreePattern: * @comp: an XSLT comp * * Free up the memory allocated by @comp */
| 225 | * Free up the memory allocated by @comp |
| 226 | */ |
| 227 | void |
| 228 | xmlFreePattern(xmlPatternPtr comp) { |
| 229 | xmlStepOpPtr op; |
| 230 | int i; |
| 231 | |
| 232 | if (comp == NULL) |
| 233 | return; |
| 234 | if (comp->next != NULL) |
| 235 | xmlFreePattern(comp->next); |
| 236 | if (comp->stream != NULL) |
| 237 | xmlFreeStreamComp(comp->stream); |
| 238 | if (comp->pattern != NULL) |
| 239 | xmlFree((xmlChar *)comp->pattern); |
| 240 | if (comp->steps != NULL) { |
| 241 | if (comp->dict == NULL) { |
| 242 | for (i = 0;i < comp->nbStep;i++) { |
| 243 | op = &comp->steps[i]; |
| 244 | if (op->value != NULL) |
| 245 | xmlFree((xmlChar *) op->value); |
| 246 | if (op->value2 != NULL) |
| 247 | xmlFree((xmlChar *) op->value2); |
| 248 | } |
| 249 | } |
| 250 | xmlFree(comp->steps); |
| 251 | } |
| 252 | if (comp->dict != NULL) |
| 253 | xmlDictFree(comp->dict); |
| 254 | |
| 255 | memset(comp, -1, sizeof(xmlPattern)); |
| 256 | xmlFree(comp); |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * xmlFreePatternList: |