summaryrefslogtreecommitdiff
path: root/source4/heimdal/base
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-07-15 09:10:30 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-15 11:15:05 +0200
commit255e3e18e00f717d99f3bc57c8a8895ff624f3c3 (patch)
treea2933c88f38e8dd7fe612be8dd458d05918b1f15 /source4/heimdal/base
parent70da27838bb3f6ed9c36add06ce0ccdf467ab1c3 (diff)
downloadsamba-255e3e18e00f717d99f3bc57c8a8895ff624f3c3.tar.gz
samba-255e3e18e00f717d99f3bc57c8a8895ff624f3c3.tar.bz2
samba-255e3e18e00f717d99f3bc57c8a8895ff624f3c3.zip
s4:heimdal: import lorikeet-heimdal-201107150856 (commit 48936803fae4a2fb362c79365d31f420c917b85b)
Diffstat (limited to 'source4/heimdal/base')
-rw-r--r--source4/heimdal/base/baselocl.h7
-rw-r--r--source4/heimdal/base/dict.c4
-rw-r--r--source4/heimdal/base/heimbase.c2
-rw-r--r--source4/heimdal/base/heimbase.h18
4 files changed, 27 insertions, 4 deletions
diff --git a/source4/heimdal/base/baselocl.h b/source4/heimdal/base/baselocl.h
index b3c81b9460..901e8606fd 100644
--- a/source4/heimdal/base/baselocl.h
+++ b/source4/heimdal/base/baselocl.h
@@ -35,6 +35,13 @@
#include "config.h"
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/source4/heimdal/base/dict.c b/source4/heimdal/base/dict.c
index 7522c8c1c4..1f9d71a0f5 100644
--- a/source4/heimdal/base/dict.c
+++ b/source4/heimdal/base/dict.c
@@ -77,7 +77,7 @@ struct heim_type_data dict_object = {
static size_t
isprime(size_t p)
{
- int q, i;
+ size_t q, i;
for(i = 2 ; i < p; i++) {
q = p / i;
@@ -120,7 +120,7 @@ heim_dict_create(size_t size)
heim_release(dict);
return NULL;
}
-
+
dict->tab = calloc(dict->size, sizeof(dict->tab[0]));
if (dict->tab == NULL) {
dict->size = 0;
diff --git a/source4/heimdal/base/heimbase.c b/source4/heimdal/base/heimbase.c
index 01668716a3..7031af9e49 100644
--- a/source4/heimdal/base/heimbase.c
+++ b/source4/heimdal/base/heimbase.c
@@ -369,7 +369,7 @@ void
heim_abortv(const char *fmt, va_list ap)
{
static char str[1024];
-
+
vsnprintf(str, sizeof(str), fmt, ap);
syslog(LOG_ERR, "heim_abort: %s", str);
abort();
diff --git a/source4/heimdal/base/heimbase.h b/source4/heimdal/base/heimbase.h
index d1ca5aa899..ad1b3f0c48 100644
--- a/source4/heimdal/base/heimbase.h
+++ b/source4/heimdal/base/heimbase.h
@@ -48,6 +48,22 @@ typedef heim_object_t heim_null_t;
#define HEIM_BASE_ONCE_INIT 0
typedef long heim_base_once_t; /* XXX arch dependant */
+#if !defined(__has_extension)
+#define __has_extension(x) 0
+#endif
+
+#define HEIM_REQUIRE_GNUC(m,n,p) \
+ (((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100) + __GNUC_PATCHLEVEL__) >= \
+ (((m) * 10000) + ((n) * 100) + (p)))
+
+
+#if __has_extension(__builtin_expect) || HEIM_REQUIRE_GNUC(3,0,0)
+#define heim_builtin_expect(_op,_res) __builtin_expect(_op,_res)
+#else
+#define heim_builtin_expect(_op,_res) (_op)
+#endif
+
+
void * heim_retain(heim_object_t);
void heim_release(heim_object_t);
@@ -79,7 +95,7 @@ heim_abortv(const char *fmt, va_list ap)
HEIMDAL_PRINTF_ATTRIBUTE((printf, 1, 0));
#define heim_assert(e,t) \
- (__builtin_expect(!(e), 0) ? heim_abort(t ":" #e) : (void)0)
+ (heim_builtin_expect(!(e), 0) ? heim_abort(t ":" #e) : (void)0)
/*
*