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

Function xmlRegCopyAtom

ThirdParty/libxml2/vtklibxml2/xmlregexp.c:831–866  ·  view source on GitHub ↗

* xmlRegCopyAtom: * @ctxt: the regexp parser context * @atom: the original atom * * Allocate a new regexp range * * Returns the new atom or NULL in case of error */

Source from the content-addressed store, hash-verified

829 * Returns the new atom or NULL in case of error
830 */
831static xmlRegAtomPtr
832xmlRegCopyAtom(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) {
833 xmlRegAtomPtr ret;
834
835 ret = (xmlRegAtomPtr) xmlMalloc(sizeof(xmlRegAtom));
836 if (ret == NULL) {
837 xmlRegexpErrMemory(ctxt);
838 return(NULL);
839 }
840 memset(ret, 0, sizeof(xmlRegAtom));
841 ret->type = atom->type;
842 ret->quant = atom->quant;
843 ret->min = atom->min;
844 ret->max = atom->max;
845 if (atom->nbRanges > 0) {
846 int i;
847
848 ret->ranges = (xmlRegRangePtr *) xmlMalloc(sizeof(xmlRegRangePtr) *
849 atom->nbRanges);
850 if (ret->ranges == NULL) {
851 xmlRegexpErrMemory(ctxt);
852 goto error;
853 }
854 for (i = 0;i < atom->nbRanges;i++) {
855 ret->ranges[i] = xmlRegCopyRange(ctxt, atom->ranges[i]);
856 if (ret->ranges[i] == NULL)
857 goto error;
858 ret->nbRanges = i + 1;
859 }
860 }
861 return(ret);
862
863error:
864 xmlRegFreeAtom(ret);
865 return(NULL);
866}
867
868static xmlRegStatePtr
869xmlRegNewState(xmlRegParserCtxtPtr ctxt) {

Callers 1

xmlFAGenerateTransitionsFunction · 0.85

Calls 3

xmlRegexpErrMemoryFunction · 0.85
xmlRegCopyRangeFunction · 0.85
xmlRegFreeAtomFunction · 0.85

Tested by

no test coverage detected