1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-14 19:24:06 +03:00

second BeOS patch from Marcin 'Shard' Konicki Daniel

* tree.c nanohttp.c threads.c: second BeOS patch from
  Marcin 'Shard' Konicki
Daniel
This commit is contained in:
Daniel Veillard 2003-11-01 17:04:58 +00:00
parent 375bf669d1
commit 254b12607d
4 changed files with 37 additions and 10 deletions

View File

@ -1,3 +1,8 @@
Sat Nov 1 17:42:27 CET 2003 Daniel Veillard <daniel@veillard.com>
* tree.c nanohttp.c threads.c: second BeOS patch from
Marcin 'Shard' Konicki
Fri Oct 31 15:35:20 CET 2003 Daniel Veillard <daniel@veillard.com>
* parser.c: always generate line numbers

View File

@ -909,6 +909,12 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
status = ioctl(s, FIONBIO, &enable);
}
#else /* VMS */
#if defined(__BEOS__)
{
bool noblock = true;
status = setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &noblock, sizeof(noblock));
}
#else /* __BEOS__ */
if ((status = fcntl(s, F_GETFL, 0)) != -1) {
#ifdef O_NONBLOCK
status |= O_NONBLOCK;
@ -927,6 +933,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
closesocket(s);
return(-1);
}
#endif /* !__BEOS__ */
#endif /* !VMS */
#endif /* !_WINSOCKAPI_ */

View File

@ -62,6 +62,7 @@ struct _xmlMutex {
HANDLE mutex;
#elif defined HAVE_BEOS_THREADS
sem_id sem;
thread_id tid;
#else
int empty;
#endif
@ -143,6 +144,7 @@ xmlNewMutex(void)
free(tok);
return NULL;
}
tok->tid = -1;
#endif
return (tok);
}
@ -191,6 +193,7 @@ xmlMutexLock(xmlMutexPtr tok)
exit();
#endif
}
tok->tid = find_thread(NULL);
#endif
}
@ -211,7 +214,10 @@ xmlMutexUnlock(xmlMutexPtr tok)
#elif defined HAVE_WIN32_THREADS
ReleaseMutex(tok->mutex);
#elif defined HAVE_BEOS_THREADS
release_sem(tok->sem);
if (tok->tid == find_thread(NULL)) {
tok->tid = -1;
release_sem(tok->sem);
}
#endif
}
@ -246,7 +252,6 @@ xmlNewRMutex(void)
return NULL;
}
tok->count = 0;
tok->tid = 0;
#endif
return (tok);
}
@ -303,12 +308,11 @@ xmlRMutexLock(xmlRMutexPtr tok)
EnterCriticalSection(&tok->cs);
++tok->count;
#elif defined HAVE_BEOS_THREADS
if (tok->tid == find_thread(NULL)) {
if (tok->lock->tid == find_thread(NULL)) {
tok->count++;
return;
} else {
xmlMutexLock(tok->lock);
tok->tid = find_thread(NULL);
tok->count = 1;
}
#endif
@ -338,10 +342,9 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
if (!--tok->count)
LeaveCriticalSection(&tok->cs);
#elif defined HAVE_BEOS_THREADS
if (tok->tid == find_thread(NULL)) {
if (tok->lock->tid == find_thread(NULL)) {
tok->count--;
if (tok->count == 0) {
tok->tid = 0;
xmlMutexUnlock(tok->lock);
}
return;

20
tree.c
View File

@ -2375,10 +2375,22 @@ xmlNewTextChild(xmlNodePtr parent, xmlNsPtr ns,
/*
* Allocate a new node
*/
if (ns == NULL)
cur = xmlNewDocRawNode(parent->doc, parent->ns, name, content);
else
cur = xmlNewDocRawNode(parent->doc, ns, name, content);
if (parent->type == XML_ELEMENT_NODE) {
if (ns == NULL)
cur = xmlNewDocRawNode(parent->doc, parent->ns, name, content);
else
cur = xmlNewDocRawNode(parent->doc, ns, name, content);
} else if ((parent->type == XML_DOCUMENT_NODE) ||
(parent->type == XML_HTML_DOCUMENT_NODE)) {
if (ns == NULL)
cur = xmlNewDocRawNode((xmlDocPtr) parent, NULL, name, content);
else
cur = xmlNewDocRawNode((xmlDocPtr) parent, ns, name, content);
} else if (parent->type == XML_DOCUMENT_FRAG_NODE) {
cur = xmlNewDocRawNode( parent->doc, ns, name, content);
} else {
return(NULL);
}
if (cur == NULL) return(NULL);
/*