MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlRegExecPushString2

Function xmlRegExecPushString2

ThirdParty/libxml2/vtklibxml2/xmlregexp.c:4020–4062  ·  view source on GitHub ↗

* 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.

Source from the content-addressed store, hash-verified

4018 * a negative value in case of error.
4019 */
4020int
4021xmlRegExecPushString2(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:

Calls 3

xmlRegExecPushStringFunction · 0.85
xmlRegCompactPushStringFunction · 0.85

Tested by

no test coverage detected