Commit 79c1df4c authored by Olivier Bertrand's avatar Olivier Bertrand

- Change the connect_xtrace variable to from int to set

  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/libdoc.cpp
parent dd07e30c
......@@ -174,7 +174,7 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
char version[]= "Version 1.06.0006 January 30, 2018";
char version[]= "Version 1.06.0006 January 31, 2018";
#if defined(__WIN__)
char compver[]= "Version 1.06.0006 " __DATE__ " " __TIME__;
char slash= '\\';
......
......@@ -194,7 +194,7 @@ void xtrc(char const *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
;
//vfprintf(stderr, fmt, ap);
vsprintf(s, fmt, ap);
if (s[strlen(s)-1] == '\n')
......@@ -210,7 +210,7 @@ static xmlStrdupFunc Strdup;
void xmlMyFree(void *mem)
{
if (trace) {
if (trace(1)) {
htrc("%.4d Freeing at %p %s\n", ++m, mem, s);
*s = 0;
} // endif trace
......@@ -220,7 +220,7 @@ void xmlMyFree(void *mem)
void *xmlMyMalloc(size_t size)
{
void *p = Malloc(size);
if (trace) {
if (trace(1)) {
htrc("%.4d Allocating %.5d at %p %s\n", ++m, size, p, s);
*s = 0;
} // endif trace
......@@ -230,7 +230,7 @@ void *xmlMyMalloc(size_t size)
void *xmlMyMallocAtomic(size_t size)
{
void *p = MallocA(size);
if (trace) {
if (trace(1)) {
htrc("%.4d Atom alloc %.5d at %p %s\n", ++m, size, p, s);
*s = 0;
} // endif trace
......@@ -240,7 +240,7 @@ void *xmlMyMallocAtomic(size_t size)
void *xmlMyRealloc(void *mem, size_t size)
{
void *p = Realloc(mem, size);
if (trace) {
if (trace(1)) {
htrc("%.4d ReAlloc %.5d to %p from %p %s\n", ++m, size, p, mem, s);
*s = 0;
} // endif trace
......@@ -250,7 +250,7 @@ void *xmlMyRealloc(void *mem, size_t size)
char *xmlMyStrdup(const char *str)
{
char *p = Strdup(str);
if (trace) {
if (trace(1)) {
htrc("%.4d Duplicating to %p from %p %s %s\n", ++m, p, str, str, s);
*s = 0;
} // endif trace
......@@ -339,7 +339,7 @@ void CloseXML2File(PGLOBAL g, PFBLOCK fp, bool all)
{
PX2BLOCK xp = (PX2BLOCK)fp;
if (trace)
if (trace(1))
htrc("CloseXML2File: xp=%p count=%d\n", xp, (xp) ? xp->Count : 0);
if (xp && xp->Count > 1 && !all) {
......@@ -387,7 +387,7 @@ bool LIBXMLDOC::Initialize(PGLOBAL g, PCSZ entry, bool zipped)
/******************************************************************/
bool LIBXMLDOC::ParseFile(PGLOBAL g, char *fn)
{
if (trace)
if (trace(1))
htrc("ParseFile\n");
if (zip) {
......@@ -436,7 +436,7 @@ PFBLOCK LIBXMLDOC::LinkXblock(PGLOBAL g, MODE m, int rc, char *fn)
/******************************************************************/
bool LIBXMLDOC::NewDoc(PGLOBAL g, PCSZ ver)
{
if (trace)
if (trace(1))
htrc("NewDoc\n");
return ((Docp = xmlNewDoc(BAD_CAST ver)) == NULL);
......@@ -447,7 +447,7 @@ bool LIBXMLDOC::NewDoc(PGLOBAL g, PCSZ ver)
/******************************************************************/
void LIBXMLDOC::AddComment(PGLOBAL g, char *txtp)
{
if (trace)
if (trace(1))
htrc("AddComment: %s\n", txtp);
xmlNodePtr cp = xmlNewDocComment(Docp, BAD_CAST txtp);
......@@ -459,7 +459,7 @@ void LIBXMLDOC::AddComment(PGLOBAL g, char *txtp)
/******************************************************************/
PXNODE LIBXMLDOC::GetRoot(PGLOBAL g)
{
if (trace)
if (trace(1))
htrc("GetRoot\n");
xmlNodePtr root = xmlDocGetRootElement(Docp);
......@@ -475,7 +475,7 @@ PXNODE LIBXMLDOC::GetRoot(PGLOBAL g)
/******************************************************************/
PXNODE LIBXMLDOC::NewRoot(PGLOBAL g, char *name)
{
if (trace)
if (trace(1))
htrc("NewRoot: %s\n", name);
xmlNodePtr root = xmlNewDocNode(Docp, NULL, BAD_CAST name, NULL);
......@@ -493,7 +493,7 @@ PXNODE LIBXMLDOC::NewRoot(PGLOBAL g, char *name)
/******************************************************************/
PXNODE LIBXMLDOC::NewPnode(PGLOBAL g, char *name)
{
if (trace)
if (trace(1))
htrc("NewNode: %s\n", name);
xmlNodePtr nop;
......@@ -534,7 +534,7 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
int rc = 0;
FILE *of;
if (trace)
if (trace(1))
htrc("DumpDoc: %s\n", ofn);
if (!(of= global_fopen(g, MSGID_CANNOT_OPEN, ofn, "w")))
......@@ -576,7 +576,7 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
/******************************************************************/
void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
{
if (trace)
if (trace(1))
htrc("CloseDoc: xp=%p count=%d\n", xp, (xp) ? xp->Count : 0);
//if (xp && xp->Count == 1) {
......@@ -630,24 +630,24 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
{
xmlNodeSetPtr nl;
if (trace)
if (trace(1))
htrc("GetNodeList: %s np=%p\n", xp, np);
if (!Ctxp) {
// Init Xpath
if (trace)
if (trace(1))
htrc("Calling xmlPathInit\n");
xmlXPathInit();
if (trace)
if (trace(1))
htrc("Calling xmlXPathNewContext Docp=%p\n", Docp);
// Create xpath evaluation context
if (!(Ctxp = xmlXPathNewContext(Docp))) {
strcpy(g->Message, MSG(XPATH_CNTX_ERR));
if (trace)
if (trace(1))
htrc("Context error: %s\n", g->Message);
return NULL;
......@@ -655,7 +655,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
// Register namespaces from list (if any)
for (PNS nsp = Namespaces; nsp; nsp = nsp->Next) {
if (trace)
if (trace(1))
htrc("Calling xmlXPathRegisterNs Prefix=%s Uri=%s\n",
nsp->Prefix, nsp->Uri);
......@@ -663,7 +663,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
BAD_CAST nsp->Uri)) {
sprintf(g->Message, MSG(REGISTER_ERR), nsp->Prefix, nsp->Uri);
if (trace)
if (trace(1))
htrc("Ns error: %s\n", g->Message);
return NULL;
......@@ -674,7 +674,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
} // endif Ctxp
if (Xop) {
if (trace)
if (trace(1))
htrc("Calling xmlXPathFreeNodeSetList Xop=%p NOFREE=%d\n",
Xop, Nofreelist);
......@@ -698,21 +698,21 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
// Set the context to the calling node
Ctxp->node = np;
if (trace)
if (trace(1))
htrc("Calling xmlXPathEval %s Ctxp=%p\n", xp, Ctxp);
// Evaluate table xpath
if (!(Xop = xmlXPathEval(BAD_CAST xp, Ctxp))) {
sprintf(g->Message, MSG(XPATH_EVAL_ERR), xp);
if (trace)
if (trace(1))
htrc("Path error: %s\n", g->Message);
return NULL;
} else
nl = Xop->nodesetval;
if (trace)
if (trace(1))
htrc("GetNodeList nl=%p n=%p\n", nl, (nl) ? nl->nodeNr : 0);
return nl;
......@@ -811,7 +811,7 @@ XML2NODE::XML2NODE(PXDOC dp, xmlNodePtr np) : XMLNODE(dp)
int XML2NODE::GetType(void)
{
if (trace)
if (trace(1))
htrc("GetType type=%d\n", Nodep->type);
return Nodep->type;
......@@ -822,7 +822,7 @@ int XML2NODE::GetType(void)
/******************************************************************/
PXNODE XML2NODE::GetNext(PGLOBAL g)
{
if (trace)
if (trace(1))
htrc("GetNext\n");
if (!Nodep->next)
......@@ -838,7 +838,7 @@ PXNODE XML2NODE::GetNext(PGLOBAL g)
/******************************************************************/
PXNODE XML2NODE::GetChild(PGLOBAL g)
{
if (trace)
if (trace(1))
htrc("GetChild\n");
if (!Nodep->children)
......@@ -856,7 +856,7 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len)
{
RCODE rc = RC_OK;
if (trace)
if (trace(1))
htrc("GetContent\n");
if (Content)
......@@ -888,7 +888,7 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len)
*p2 = 0;
if (trace)
if (trace(1))
htrc("GetText buf='%s' len=%d\n", buf, len);
xmlFree(Content);
......@@ -896,7 +896,7 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len)
} else
*buf = '\0';
if (trace)
if (trace(1))
htrc("GetContent: %s\n", buf);
return rc;
......@@ -907,12 +907,12 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len)
/******************************************************************/
bool XML2NODE::SetContent(PGLOBAL g, char *txtp, int len)
{
if (trace)
if (trace(1))
htrc("SetContent: %s\n", txtp);
xmlChar *buf = xmlEncodeEntitiesReentrant(Docp, BAD_CAST txtp);
if (trace)
if (trace(1))
htrc("SetContent: %s -> %s\n", txtp, buf);
xmlNodeSetContent(Nodep, buf);
......@@ -925,7 +925,7 @@ bool XML2NODE::SetContent(PGLOBAL g, char *txtp, int len)
/******************************************************************/
PXNODE XML2NODE::Clone(PGLOBAL g, PXNODE np)
{
if (trace)
if (trace(1))
htrc("Clone: np=%p\n", np);
if (np) {
......@@ -941,7 +941,7 @@ PXNODE XML2NODE::Clone(PGLOBAL g, PXNODE np)
/******************************************************************/
PXLIST XML2NODE::GetChildElements(PGLOBAL g, char *xp, PXLIST lp)
{
if (trace)
if (trace(1))
htrc("GetChildElements: %s\n", xp);
return SelectNodes(g, (xp) ? xp : (char*)"*", lp);
......@@ -952,7 +952,7 @@ PXLIST XML2NODE::GetChildElements(PGLOBAL g, char *xp, PXLIST lp)
/******************************************************************/
PXLIST XML2NODE::SelectNodes(PGLOBAL g, char *xp, PXLIST lp)
{
if (trace)
if (trace(1))
htrc("SelectNodes: %s\n", xp);
xmlNodeSetPtr nl = ((PXDOC2)Doc)->GetNodeList(g, Nodep, xp);
......@@ -970,7 +970,7 @@ PXLIST XML2NODE::SelectNodes(PGLOBAL g, char *xp, PXLIST lp)
/******************************************************************/
PXNODE XML2NODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
{
if (trace)
if (trace(1))
htrc("SelectSingleNode: %s\n", xp);
xmlNodeSetPtr nl = ((PXDOC2)Doc)->GetNodeList(g, Nodep, xp);
......@@ -994,7 +994,7 @@ PXATTR XML2NODE::GetAttribute(PGLOBAL g, char *name, PXATTR ap)
{
xmlAttrPtr atp;
if (trace)
if (trace(1))
htrc("GetAttribute: %s\n", SVP(name));
if (name)
......@@ -1023,7 +1023,7 @@ PXNODE XML2NODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np)
{
char *p, *pn, *pf = NULL, *nmp = PlugDup(g, name);
if (trace)
if (trace(1))
htrc("AddChildNode: %s\n", name);
// Is a prefix specified
......@@ -1074,7 +1074,7 @@ PXNODE XML2NODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np)
/******************************************************************/
PXATTR XML2NODE::AddProperty(PGLOBAL g, char *name, PXATTR ap)
{
if (trace)
if (trace(1))
htrc("AddProperty: %s\n", name);
xmlAttrPtr atp = xmlNewProp(Nodep, BAD_CAST name, NULL);
......@@ -1097,7 +1097,7 @@ PXATTR XML2NODE::AddProperty(PGLOBAL g, char *name, PXATTR ap)
/******************************************************************/
void XML2NODE::AddText(PGLOBAL g, PCSZ txtp)
{
if (trace)
if (trace(1))
htrc("AddText: %s\n", txtp);
// This is to avoid a blank line when inserting a new line
......@@ -1119,7 +1119,7 @@ void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp)
{
xmlErrorPtr xerr;
if (trace)
if (trace(1))
htrc("DeleteChild: node=%p\n", dnp);
xmlNodePtr np = ((PNODE2)dnp)->Nodep;
......@@ -1157,7 +1157,7 @@ void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp)
return;
err:
if (trace)
if (trace(1))
htrc("DeleteChild: errmsg=%s\n", xerr->message);
xmlResetError(xerr);
......@@ -1187,7 +1187,7 @@ int XML2NODELIST::GetLength(void)
/******************************************************************/
PXNODE XML2NODELIST::GetItem(PGLOBAL g, int n, PXNODE np)
{
if (trace)
if (trace(1))
htrc("GetItem: %d\n", n);
if (!Listp || Listp->nodeNr <= n)
......@@ -1206,7 +1206,7 @@ PXNODE XML2NODELIST::GetItem(PGLOBAL g, int n, PXNODE np)
/******************************************************************/
bool XML2NODELIST::DropItem(PGLOBAL g, int n)
{
if (trace)
if (trace(1))
htrc("DropItem: n=%d\n", n);
// We should do something here
......@@ -1234,7 +1234,7 @@ XML2ATTR::XML2ATTR(PXDOC dp, xmlAttrPtr ap, xmlNodePtr np)
/******************************************************************/
PXATTR XML2ATTR::GetNext(PGLOBAL g)
{
if (trace)
if (trace(1))
htrc("Attr GetNext\n");
if (!Atrp->next)
......@@ -1252,7 +1252,7 @@ RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len)
RCODE rc = RC_OK;
xmlChar *txt;
if (trace)
if (trace(1))
htrc("GetText\n");
if ((txt = xmlGetProp(Atrp->parent, Atrp->name))) {
......@@ -1269,7 +1269,7 @@ RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len)
} else
*buf = '\0';
if (trace)
if (trace(1))
htrc("GetText: %s\n", buf);
return rc;
......@@ -1280,7 +1280,7 @@ RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len)
/******************************************************************/
bool XML2ATTR::SetText(PGLOBAL g, char *txtp, int len)
{
if (trace)
if (trace(1))
htrc("SetText: %s %d\n", txtp, len);
xmlSetProp(Parent, Atrp->name, BAD_CAST txtp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment