summaryrefslogtreecommitdiffstats
path: root/collection
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-08-10 11:55:27 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-08-13 14:37:19 -0400
commitbf98ddf34edf25064e96594d782e8418fcd80f77 (patch)
tree9b7a41c8e72df0dcc825e6866841c9b4535f1ba3 /collection
parent345e0fbc582d212f0fe580b83a16b5932640ee63 (diff)
downloadding-libs2-bf98ddf34edf25064e96594d782e8418fcd80f77.tar.gz
ding-libs2-bf98ddf34edf25064e96594d782e8418fcd80f77.tar.xz
ding-libs2-bf98ddf34edf25064e96594d782e8418fcd80f77.zip
Update libcollection with new make environment
Diffstat (limited to 'collection')
-rw-r--r--collection/Makefile.am4
-rw-r--r--collection/configure.ac4
-rw-r--r--collection/trace.h159
3 files changed, 163 insertions, 4 deletions
diff --git a/collection/Makefile.am b/collection/Makefile.am
index 4e90aed..1d9e98c 100644
--- a/collection/Makefile.am
+++ b/collection/Makefile.am
@@ -12,7 +12,7 @@ if HAVE_GCC
-Wcast-align -Wwrite-strings
endif
-AM_CPPFLAGS = -I$(topdir) -I$(topdir)/trace $(TRACE_LEVEL)
+AM_CPPFLAGS = $(TRACE_LEVEL)
ACLOCAL_AMFLAGS = -I m4
@@ -39,7 +39,7 @@ libcollection_la_SOURCES = \
collection_cmp.c \
collection_iter.c \
collection_priv.h \
- ../trace/trace.h
+ trace.h
libcollection_la_LDFLAGS = \
-version-info 2:0:0
diff --git a/collection/configure.ac b/collection/configure.ac
index 02c0ab4..21723d5 100644
--- a/collection/configure.ac
+++ b/collection/configure.ac
@@ -1,5 +1,5 @@
-AC_INIT([collection],
- [0.5.0],
+AC_INIT([libcollection],
+ [0.5.1],
[sssd-devel@lists.fedorahosted.org])
AC_CONFIG_SRCDIR([collection.c])
AC_CONFIG_AUX_DIR([build])
diff --git a/collection/trace.h b/collection/trace.h
new file mode 100644
index 0000000..04aa5c8
--- /dev/null
+++ b/collection/trace.h
@@ -0,0 +1,159 @@
+/*
+ COMMON TRACE
+
+ Common header file for tracing.
+
+ Copyright (C) Dmitri Pal <dpal@redhat.com> 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef COMMON_TRACE_H
+#define COMMON_TRACE_H
+
+#ifdef TRACE_LEVEL
+#define HAVE_TRACE
+#include <stdio.h>
+
+/* The trace level is a bit mask */
+#define TRACE_FLOW 0x0000001 /* - trace messages that are entry exit into functions */
+#define TRACE_ERROR 0x0000002 /* - trace messages that are errors */
+#define TRACE_INFO 0x0000004 /* - trace things that are informational */
+
+
+#ifdef TRACE_HOME /* Define this in the module that contains main */
+unsigned trace_level = TRACE_LEVEL;
+#else
+extern unsigned trace_level;
+#endif /* TRACE_HOME */
+#endif /* TRACE_LEVEL */
+
+
+
+#ifdef HAVE_TRACE
+/* Tracing strings */
+#define TRACE_STRING(level, msg, str) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %40s (%4d) %s%s %s\n", \
+ __FILE__, __LINE__, \
+ (level == TRACE_ERROR) ? "ERROR-> " : "", \
+ (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (str != NULL) ? str : "(null)"); \
+ } \
+ } while(0)
+
+/* Tracing unsigned numbers */
+#define TRACE_NUMBER(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %40s (%4d) %s%s %lu\n", \
+ __FILE__, __LINE__, \
+ (level == TRACE_ERROR) ? "ERROR-> " : "", \
+ (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (unsigned long int)(num)); \
+ } \
+ } while(0)
+
+/* Tracing signed numbers */
+#define TRACE_SNUMBER(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %40s (%4d) %s%s %ld\n", \
+ __FILE__, __LINE__, \
+ (level == TRACE_ERROR) ? "ERROR-> " : "", \
+ (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (long int)(num)); \
+ } \
+ } while(0)
+
+/* Tracing long numbers */
+#define TRACE_LNUMBER(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %40s (%4d) %s%s %llu\n", \
+ __FILE__, __LINE__, \
+ (level == TRACE_ERROR) ? "ERROR-> " : "", \
+ (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (unsigned long long int)(num)); \
+ } \
+ } while(0)
+
+/* Tracing signed long numbers */
+#define TRACE_SLNUMBER(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %40s (%4d) %s%s %lld\n", \
+ __FILE__, __LINE__, \
+ (level == TRACE_ERROR) ? "ERROR-> " : "", \
+ (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (long long int)(num)); \
+ } \
+ } while(0)
+
+/* Tracing doubles */
+#define TRACE_DOUBLE(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %40s (%4d) %s%s %e\n", \
+ __FILE__, __LINE__, \
+ (level == TRACE_ERROR) ? "ERROR-> " : "", \
+ (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (double)(num)); \
+ } \
+ } while(0)
+
+/* Assertion */
+#define TRACE_ASSERT(expression) expression ? : printf("ASSERTION FAILED\n")
+#else /* HAVE_TRACE */
+
+/* Noop in case the tracing is disabled */
+#define TRACE_STRING(level, msg, str)
+#define TRACE_NUMBER(level, msg, num)
+#define TRACE_SNUMBER(level, msg, num)
+#define TRACE_LNUMBER(level, msg, num)
+#define TRACE_SLNUMBER(level, msg, num)
+#define TRACE_DOUBLE(level, msg, num)
+#endif /* HAVE_TRACE */
+
+
+/* Convenience wrappers for strings */
+#define TRACE_FLOW_STRING(msg, str) TRACE_STRING(TRACE_FLOW, msg, str)
+#define TRACE_ERROR_STRING(msg, str) TRACE_STRING(TRACE_ERROR, msg, str)
+#define TRACE_INFO_STRING(msg, str) TRACE_STRING(TRACE_INFO, msg, str)
+
+/* Convenience wrappers for unsigned numbers */
+#define TRACE_FLOW_NUMBER(msg, num) TRACE_NUMBER(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_NUMBER(msg, num) TRACE_NUMBER(TRACE_ERROR, msg, num)
+#define TRACE_INFO_NUMBER(msg, num) TRACE_NUMBER(TRACE_INFO, msg, num)
+
+/* Convenience wrappers for signed numbers */
+#define TRACE_FLOW_SNUMBER(msg, num) TRACE_SNUMBER(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_SNUMBER(msg, num) TRACE_SNUMBER(TRACE_ERROR, msg, num)
+#define TRACE_INFO_SNUMBER(msg, num) TRACE_SNUMBER(TRACE_INFO, msg, num)
+
+/* Convenience wrappers for 64-bit long unsigned numbers */
+#define TRACE_FLOW_LNUMBER(msg, num) TRACE_LNUMBER(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_LNUMBER(msg, num) TRACE_LNUMBER(TRACE_ERROR, msg, num)
+#define TRACE_INFO_LNUMBER(msg, num) TRACE_LNUMBER(TRACE_INFO, msg, num)
+
+/* Convenience wrappers for 64-bit long signed numbers */
+#define TRACE_FLOW_SLNUMBER(msg, num) TRACE_SLNUMBER(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_SLNUMBER(msg, num) TRACE_SLNUMBER(TRACE_ERROR, msg, num)
+#define TRACE_INFO_SLNUMBER(msg, num) TRACE_SLNUMBER(TRACE_INFO, msg, num)
+
+/* Convenience wrappers for numbers */
+#define TRACE_FLOW_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_ERROR, msg, num)
+#define TRACE_INFO_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_INFO, msg, num)
+
+#endif /* COMMON_TRACE_H */