| 3030 | ************************************************************************/ |
| 3031 | |
| 3032 | static void |
| 3033 | xmlFARegExecSave(xmlRegExecCtxtPtr exec) { |
| 3034 | #ifdef MAX_PUSH |
| 3035 | if (exec->nbPush > MAX_PUSH) { |
| 3036 | exec->status = XML_REGEXP_INTERNAL_LIMIT; |
| 3037 | return; |
| 3038 | } |
| 3039 | exec->nbPush++; |
| 3040 | #endif |
| 3041 | |
| 3042 | if (exec->maxRollbacks == 0) { |
| 3043 | exec->maxRollbacks = 4; |
| 3044 | exec->rollbacks = (xmlRegExecRollback *) xmlMalloc(exec->maxRollbacks * |
| 3045 | sizeof(xmlRegExecRollback)); |
| 3046 | if (exec->rollbacks == NULL) { |
| 3047 | exec->maxRollbacks = 0; |
| 3048 | exec->status = XML_REGEXP_OUT_OF_MEMORY; |
| 3049 | return; |
| 3050 | } |
| 3051 | memset(exec->rollbacks, 0, |
| 3052 | exec->maxRollbacks * sizeof(xmlRegExecRollback)); |
| 3053 | } else if (exec->nbRollbacks >= exec->maxRollbacks) { |
| 3054 | xmlRegExecRollback *tmp; |
| 3055 | int len = exec->maxRollbacks; |
| 3056 | |
| 3057 | exec->maxRollbacks *= 2; |
| 3058 | tmp = (xmlRegExecRollback *) xmlRealloc(exec->rollbacks, |
| 3059 | exec->maxRollbacks * sizeof(xmlRegExecRollback)); |
| 3060 | if (tmp == NULL) { |
| 3061 | exec->maxRollbacks /= 2; |
| 3062 | exec->status = XML_REGEXP_OUT_OF_MEMORY; |
| 3063 | return; |
| 3064 | } |
| 3065 | exec->rollbacks = tmp; |
| 3066 | tmp = &exec->rollbacks[len]; |
| 3067 | memset(tmp, 0, (exec->maxRollbacks - len) * sizeof(xmlRegExecRollback)); |
| 3068 | } |
| 3069 | exec->rollbacks[exec->nbRollbacks].state = exec->state; |
| 3070 | exec->rollbacks[exec->nbRollbacks].index = exec->index; |
| 3071 | exec->rollbacks[exec->nbRollbacks].nextbranch = exec->transno + 1; |
| 3072 | if (exec->comp->nbCounters > 0) { |
| 3073 | if (exec->rollbacks[exec->nbRollbacks].counts == NULL) { |
| 3074 | exec->rollbacks[exec->nbRollbacks].counts = (int *) |
| 3075 | xmlMalloc(exec->comp->nbCounters * sizeof(int)); |
| 3076 | if (exec->rollbacks[exec->nbRollbacks].counts == NULL) { |
| 3077 | exec->status = XML_REGEXP_OUT_OF_MEMORY; |
| 3078 | return; |
| 3079 | } |
| 3080 | } |
| 3081 | memcpy(exec->rollbacks[exec->nbRollbacks].counts, exec->counts, |
| 3082 | exec->comp->nbCounters * sizeof(int)); |
| 3083 | } |
| 3084 | exec->nbRollbacks++; |
| 3085 | } |
| 3086 | |
| 3087 | static void |
| 3088 | xmlFARegExecRollBack(xmlRegExecCtxtPtr exec) { |
no outgoing calls
no test coverage detected