[sr-dev] git:master: srdb1: fix compile warning related to strptime on linux

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 5 13:46:27 CEST 2011


Module: sip-router
Branch: master
Commit: 28af5617ff471e975dbfeea0e49112e9f0f607f8
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=28af5617ff471e975dbfeea0e49112e9f0f607f8

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Sep  5 13:44:06 2011 +0200

srdb1: fix compile warning related to strptime on linux

---

 lib/srdb1/db_ut.c |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/lib/srdb1/db_ut.c b/lib/srdb1/db_ut.c
index fbc037c..80aa4c7 100644
--- a/lib/srdb1/db_ut.c
+++ b/lib/srdb1/db_ut.c
@@ -30,17 +30,37 @@
  * \ingroup db1
  */
 
-#include "db_ut.h"
 
-#include "../../mem/mem.h"
-#include "../../dprint.h"
-#include "../../pvar.h"
+/**
+ * make strptime available
+ * use 600 for 'Single UNIX Specification, Version 3'
+ * _XOPEN_SOURCE creates conflict in swab definition in Solaris
+ */
+#ifndef __OS_solaris
+	#define _XOPEN_SOURCE 600          /* glibc2 on linux, bsd */
+	#define _BSD_SOURCE 1              /* needed on linux to "fix" the effect
+										 of the above define on 
+										 features.h/unistd.h syscall() */
+#else
+	#define _XOPEN_SOURCE_EXTENDED 1   /* solaris */
+#endif
+
+#include <time.h>
+
+#undef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE_EXTENDED
+
 #include <limits.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include "../../mem/mem.h"
+#include "../../dprint.h"
+
+#include "db_ut.h"
+
 
 inline int db_str2int(const char* _s, int* _v)
 {




More information about the sr-dev mailing list