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

Function xmlVSetError

ThirdParty/libxml2/vtklibxml2/error.c:28–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 ************************************************************************/
27
28static int
29xmlVSetError(xmlError *err,
30 void *ctxt, xmlNodePtr node,
31 int domain, int code, xmlErrorLevel level,
32 const char *file, int line,
33 const char *str1, const char *str2, const char *str3,
34 int int1, int col,
35 const char *fmt, va_list ap)
36{
37 char *message = NULL;
38 char *fileCopy = NULL;
39 char *str1Copy = NULL;
40 char *str2Copy = NULL;
41 char *str3Copy = NULL;
42
43 if (code == XML_ERR_OK) {
44 xmlResetError(err);
45 return(0);
46 }
47
48 /*
49 * Formatting the message
50 */
51 if (fmt == NULL) {
52 message = xmlMemStrdup("No error message provided");
53 } else {
54 xmlChar *tmp;
55 int res;
56
57 res = xmlStrVASPrintf(&tmp, MAX_ERR_MSG_SIZE, fmt, ap);
58 if (res < 0)
59 goto err_memory;
60 message = (char *) tmp;
61 }
62 if (message == NULL)
63 goto err_memory;
64
65 if (file != NULL) {
66 fileCopy = (char *) xmlStrdup((const xmlChar *) file);
67 if (fileCopy == NULL)
68 goto err_memory;
69 }
70 if (str1 != NULL) {
71 str1Copy = (char *) xmlStrdup((const xmlChar *) str1);
72 if (str1Copy == NULL)
73 goto err_memory;
74 }
75 if (str2 != NULL) {
76 str2Copy = (char *) xmlStrdup((const xmlChar *) str2);
77 if (str2Copy == NULL)
78 goto err_memory;
79 }
80 if (str3 != NULL) {
81 str3Copy = (char *) xmlStrdup((const xmlChar *) str3);
82 if (str3Copy == NULL)
83 goto err_memory;
84 }
85

Callers 2

LIBXML_ATTR_FORMATFunction · 0.85
xmlVUpdateErrorFunction · 0.85

Calls 3

xmlResetErrorFunction · 0.85
xmlStrVASPrintfFunction · 0.85
xmlStrdupFunction · 0.85

Tested by

no test coverage detected