summaryrefslogtreecommitdiffstats
path: root/libcsoap/soap-addressing.c
diff options
context:
space:
mode:
authorGravatar m0gg2006-12-14 19:36:49 +0000
committerGravatar m0gg2006-12-14 19:36:49 +0000
commit26502adcbd76cbb3886907f6673ba25be21a7856 (patch)
tree9f0e7e9fa30ef2dce08e535a4bfabcee696766ff /libcsoap/soap-addressing.c
parent90ca1cce54c40d2dde3995d1a9d68f9db93c40c9 (diff)
downloadcsoap-26502adcbd76cbb3886907f6673ba25be21a7856.tar.gz
csoap-26502adcbd76cbb3886907f6673ba25be21a7856.tar.bz2
Linux compile fixes
Diffstat (limited to 'libcsoap/soap-addressing.c')
-rw-r--r--libcsoap/soap-addressing.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/libcsoap/soap-addressing.c b/libcsoap/soap-addressing.c
index 8cb11b8..ebe6e66 100644
--- a/libcsoap/soap-addressing.c
+++ b/libcsoap/soap-addressing.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-addressing.c,v 1.9 2006/11/29 11:04:24 m0gg Exp $
+* $Id: soap-addressing.c,v 1.10 2006/12/14 19:36:49 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2006 Heiko Ronsdorf
@@ -45,6 +45,10 @@
#include <string.h>
#endif
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+#endif
+
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
@@ -66,6 +70,7 @@
#include "soap-server.h"
#include "soap-addressing.h"
+#ifdef HAVE_UUID_CREATE
static const xmlChar *
_soap_addressing_uuid_error(uint32_t status)
{
@@ -117,6 +122,27 @@ _soap_addressing_generate_id(void)
return ret;
}
+#else
+static char *
+_soap_addressing_generate_id(void)
+{
+ char *ret;
+ static long counter = 0;
+ static pthread_mutex_t counter_lock = PTHREAD_MUTEX_INITIALIZER;
+
+ if (!(ret = (char *)malloc(128)))
+ {
+ log_error2("malloc failed (%s)", strerror(errno));
+ return NULL;
+ }
+
+ pthread_mutex_lock(&counter_lock);
+ sprintf("%s/%i", soap_server_get_name(), counter);
+ pthread_mutex_unlock(&counter_lock);
+
+ return ret;
+}
+#endif
static xmlNsPtr
_soap_addressing_get_namespace(xmlNodePtr node)