ソースを参照

Replace bd::Queue usage with std::deque

Bryan Drewery 11 年 前
コミット
9d70b55e66
2 ファイル変更9 行追加7 行削除
  1. 4 3
      src/mod/irc.mod/chan.cc
  2. 5 4
      src/mod/irc.mod/irc.cc

+ 4 - 3
src/mod/irc.mod/chan.cc

@@ -2093,12 +2093,13 @@ static int got315(char *from, char *msg)
 
 
   putlog(LOG_DEBUG, "*", "END who %s", chname);
   putlog(LOG_DEBUG, "*", "END who %s", chname);
 
 
-  if (!chained_who.isEmpty()) {
+  if (!chained_who.empty()) {
     // Send off next WHO request
     // Send off next WHO request
     while (1) {
     while (1) {
-      if (chained_who.isEmpty()) break;
+      if (chained_who.empty()) break;
       // Dequeue the next chan in the chain
       // Dequeue the next chan in the chain
-      chan = findchan(bd::String(chained_who.dequeue()).c_str());
+      chan = findchan(chained_who.front().c_str());
+      chained_who.pop_front();
       if (chan) {
       if (chan) {
         if (!strcmp(chan->name, chname)) continue; // First reply got queued too
         if (!strcmp(chan->name, chname)) continue; // First reply got queued too
         if (!shouldjoin(chan)) continue; // No longer care about this channel
         if (!shouldjoin(chan)) continue; // No longer care about this channel

+ 5 - 4
src/mod/irc.mod/irc.cc

@@ -56,8 +56,8 @@
 #include "src/mod/ctcp.mod/ctcp.h"
 #include "src/mod/ctcp.mod/ctcp.h"
 #include <bdlib/src/String.h>
 #include <bdlib/src/String.h>
 #include <bdlib/src/HashTable.h>
 #include <bdlib/src/HashTable.h>
-#include <bdlib/src/Queue.h>
 #include <bdlib/src/base64.h>
 #include <bdlib/src/base64.h>
+#include <deque>
 
 
 #include <stdarg.h>
 #include <stdarg.h>
 
 
@@ -94,7 +94,7 @@ bool include_lk = 1;      /* For correct calculation
 bd::HashTable<bd::String, unsigned long> bot_counters;
 bd::HashTable<bd::String, unsigned long> bot_counters;
 unsigned long my_cookie_counter = 0;
 unsigned long my_cookie_counter = 0;
 
 
-static bd::Queue<bd::String> chained_who;
+static std::deque<bd::String> chained_who;
 static int chained_who_idx;
 static int chained_who_idx;
 
 
 static int
 static int
@@ -1314,8 +1314,9 @@ reset_chan_info(struct chanset_t *chan)
 
 
 static void send_chan_who(int queue, struct chanset_t *chan, bool chain) {
 static void send_chan_who(int queue, struct chanset_t *chan, bool chain) {
   if (chain) {
   if (chain) {
-    if (!chained_who.contains(chan->name))
-      chained_who.enqueue(chan->name);
+    if (std::find(std::begin(chained_who), std::end(chained_who),
+          chan->name) != std::end(chained_who))
+      chained_who.push_back(chan->name);
     chained_who_idx = queue;
     chained_who_idx = queue;
     if (chained_who.size() > 1)
     if (chained_who.size() > 1)
       return;
       return;