Просмотр исходного кода

Merge branch 'std-bdlib'

* std-bdlib:
  Fix handling of creating empty bd::Array() after removing implicit carray conversion
  Define std::hash specializations rather than bd::Hash
  Update bdlib to bring in new std requirements
Bryan Drewery 11 лет назад
Родитель
Сommit
9a1794d742
4 измененных файлов с 36 добавлено и 41 удалено
  1. 1 1
      lib/bdlib
  2. 1 1
      src/adns.cc
  3. 34 9
      src/chan.h
  4. 0 30
      src/eggdrop.h

+ 1 - 1
lib/bdlib

@@ -1 +1 @@
-Subproject commit 9aeeb2bd24d9155f4a4b6a89f96f1f096b411f25
+Subproject commit 79906b85b4c14856142e044139210bb3326de969

+ 1 - 1
src/adns.cc

@@ -712,7 +712,7 @@ int egg_dns_reverse(const char *ip, interval_t timeout, dns_callback_t callback,
 	if (!is_dotted_ip(ip)) {
 		/* If it's not a valid ip, don't even make the request. */
 		sdprintf("egg_dns_reverse(%s, %d): Not an ip.", ip, timeout);
-		callback(-1, client_data, ip, NULL);
+		callback(-1, client_data, ip, {});
 		return(-1);
 	}
 

+ 34 - 9
src/chan.h

@@ -8,9 +8,36 @@
 #ifndef _EGG_CHAN_H
 #define _EGG_CHAN_H
 
+#include <functional>
 #include <lib/bdlib/src/Array.h>
 #include <lib/bdlib/src/String.h>
 
+/* chan & global */
+enum flood_t {
+  FLOOD_PRIVMSG  = 0,
+  FLOOD_NOTICE   = 1,
+  FLOOD_CTCP     = 2,
+  FLOOD_NICK     = 3,
+  FLOOD_JOIN     = 4,
+  FLOOD_KICK     = 5,
+  FLOOD_DEOP     = 6,
+  FLOOD_PART     = 7,
+  FLOOD_BYTES    = 8
+};
+
+namespace std {
+  template<>
+  struct hash<flood_t>
+  {
+    inline size_t operator()(flood_t val) const {
+      return static_cast<size_t>(val);
+    }
+  };
+}
+
+#define FLOOD_CHAN_MAX   9
+#define FLOOD_GLOBAL_MAX 3
+
 typedef struct memstruct {
   struct memstruct *next;
   struct userrec *user;
@@ -31,18 +58,16 @@ typedef struct memstruct {
   bd::HashTable<flood_t, int>         *floodnum; // floodnum[FLOOD_PRIVMSG] = 1;
 } memberlist;
 
-#include <bdlib/src/bdlib.h>
-BDLIB_NS_BEGIN
-template<typename T>
-  struct Hash;
-
-template<>
-  struct Hash<memberlist*>
+namespace std {
+  template<>
+  struct hash<memberlist*>
   {
     // Use memory address
-    inline size_t operator()(memberlist* m) const { return reinterpret_cast<size_t>(m); }
+    inline size_t operator()(memberlist* m) const {
+      return reinterpret_cast<size_t>(m);
+    }
   };
-BDLIB_NS_END
+}
 
 #define CHAN_FLAG_OP	1
 #define CHAN_FLAG_VOICE 2

+ 0 - 30
src/eggdrop.h

@@ -125,36 +125,6 @@ enum {		/* TAKE A GUESS */
   ERROR
 };
 
-
-/* chan & global */
-enum flood_t {
-  FLOOD_PRIVMSG  = 0,
-  FLOOD_NOTICE   = 1,
-  FLOOD_CTCP     = 2,
-  FLOOD_NICK     = 3,
-  FLOOD_JOIN     = 4,
-  FLOOD_KICK     = 5,
-  FLOOD_DEOP     = 6,
-  FLOOD_PART     = 7,
-  FLOOD_BYTES    = 8
-};
-
-
-#include <bdlib/src/bdlib.h>
-BDLIB_NS_BEGIN
-template<typename T>
-  struct Hash;
-
-template<>
-  struct Hash<flood_t>
-  {
-    inline size_t operator()(flood_t val) const { return static_cast<size_t>(val); }
-  };
-BDLIB_NS_END
-
-#define FLOOD_CHAN_MAX   9
-#define FLOOD_GLOBAL_MAX 3
-
 #define FEATURE_1		BIT0
 #define FEATURE_2		BIT1