Skip to content

Instantly share code, notes, and snippets.

@Habbie
Created April 26, 2013 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Habbie/5466695 to your computer and use it in GitHub Desktop.
Save Habbie/5466695 to your computer and use it in GitHub Desktop.
diff -urN pdns-2.9.22/pdns/statbag.cc pdns-2.9.22-new/pdns/statbag.cc
--- pdns-2.9.22/pdns/statbag.cc 2008-11-15 22:10:14.000000000 +0000
+++ pdns-2.9.22-new/pdns/statbag.cc 2010-11-22 09:59:22.000000000 +0000
@@ -96,7 +96,7 @@
-void StatBag::set(const string &key, int value)
+void StatBag::set(const string &key, unsigned int value)
{
lock();
exists(key);
@@ -105,7 +105,7 @@
unlock();
}
-int StatBag::read(const string &key)
+unsigned int StatBag::read(const string &key)
{
lock();
@@ -115,14 +115,14 @@
return 0;
}
- int tmp=*d_stats[key];
+ unsigned int tmp=*d_stats[key];
unlock();
return tmp;
}
-int StatBag::readZero(const string &key)
+unsigned int StatBag::readZero(const string &key)
{
lock();
@@ -134,7 +134,7 @@
}
- int tmp=*d_stats[key];
+ unsigned int tmp=*d_stats[key];
d_stats[key]=0;
unlock();
diff -urN pdns-2.9.22/pdns/statbag.hh pdns-2.9.22-new/pdns/statbag.hh
--- pdns-2.9.22/pdns/statbag.hh 2008-11-15 22:07:46.000000000 +0000
+++ pdns-2.9.22-new/pdns/statbag.hh 2010-11-22 10:02:46.000000000 +0000
@@ -93,9 +93,9 @@
void exists(const string &key); //!< call this function to throw an exception in case a key does not exist
inline void deposit(const string &key, int value); //!< increment the statistics behind this key by value amount
inline void inc(const string &key); //!< increase this key's value by one
- void set(const string &key, int value); //!< set this key's value
- int read(const string &key); //!< read the value behind this key
- int readZero(const string &key); //!< read the value behind this key, and zero it afterwards
+ void set(const string &key, unsigned int value); //!< set this key's value
+ unsigned int read(const string &key); //!< read the value behind this key
+ unsigned int readZero(const string &key); //!< read the value behind this key, and zero it afterwards
unsigned int *getPointer(const string &key); //!< get a direct pointer to the value behind a key. Use this for high performance increments
string getValueStr(const string &key); //!< read a value behind a key, and return it as a string
string getValueStrZero(const string &key); //!< read a value behind a key, and return it as a string, and zero afterwards
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment