* xmlRegExecPushString2: * @exec: a regexp execution context or NULL to indicate the end * @value: the first string token input * @value2: the second string token input * @data: data associated to the token to reuse in callbacks * * Push one input token in the execution context * * Returns: 1 if the regexp reached a final state, 0 if non-final, and * a negative value in case of error.
| 4018 | * a negative value in case of error. |
| 4019 | */ |
| 4020 | int |
| 4021 | xmlRegExecPushString2(xmlRegExecCtxtPtr exec, const xmlChar *value, |
| 4022 | const xmlChar *value2, void *data) { |
| 4023 | xmlChar buf[150]; |
| 4024 | int lenn, lenp, ret; |
| 4025 | xmlChar *str; |
| 4026 | |
| 4027 | if (exec == NULL) |
| 4028 | return(-1); |
| 4029 | if (exec->comp == NULL) |
| 4030 | return(-1); |
| 4031 | if (exec->status != XML_REGEXP_OK) |
| 4032 | return(exec->status); |
| 4033 | |
| 4034 | if (value2 == NULL) |
| 4035 | return(xmlRegExecPushString(exec, value, data)); |
| 4036 | |
| 4037 | lenn = strlen((char *) value2); |
| 4038 | lenp = strlen((char *) value); |
| 4039 | |
| 4040 | if (150 < lenn + lenp + 2) { |
| 4041 | str = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2); |
| 4042 | if (str == NULL) { |
| 4043 | exec->status = XML_REGEXP_OUT_OF_MEMORY; |
| 4044 | return(-1); |
| 4045 | } |
| 4046 | } else { |
| 4047 | str = buf; |
| 4048 | } |
| 4049 | memcpy(&str[0], value, lenp); |
| 4050 | str[lenp] = XML_REG_STRING_SEPARATOR; |
| 4051 | memcpy(&str[lenp + 1], value2, lenn); |
| 4052 | str[lenn + lenp + 1] = 0; |
| 4053 | |
| 4054 | if (exec->comp->compact != NULL) |
| 4055 | ret = xmlRegCompactPushString(exec, exec->comp, str, data); |
| 4056 | else |
| 4057 | ret = xmlRegExecPushStringInternal(exec, str, data, 1); |
| 4058 | |
| 4059 | if (str != buf) |
| 4060 | xmlFree(str); |
| 4061 | return(ret); |
| 4062 | } |
| 4063 | |
| 4064 | /** |
| 4065 | * xmlRegExecGetValues: |
no test coverage detected