123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- $OpenBSD: patch-src_descr_maintainer_h,v 1.1 2014/03/27 04:00:25 bentley Exp $
- Conflicting macro.
- Committed upstream in bzr 6349.
- --- src/descr_maintainer.h.orig Sun Apr 15 16:49:17 2012
- +++ src/descr_maintainer.h Sun Apr 15 16:55:32 2012
- @@ -28,7 +28,7 @@
- * Worker_Descr and so on.
- */
- template <typename T> struct Descr_Maintainer {
- - Descr_Maintainer() : capacity(0), nitems(0), items(0) {}
- + Descr_Maintainer() : capacity(0), nitemsw(0), items(0) {}
- ~Descr_Maintainer();
-
- static typename T::Index invalid_index() {
- @@ -37,13 +37,13 @@ template <typename T> struct Descr_Maintainer {
-
- T * exists(char const * name) const;
- int32_t add(T *);
- - typename T::Index get_nitems() const throw () {return nitems;}
- + typename T::Index get_nitems() const throw () {return nitemsw;}
-
- struct Nonexistent {};
-
- int32_t get_index(std::string const & name) const throw (Nonexistent)
- {
- - for (typename T::Index i = 0; i < nitems; ++i)
- + for (typename T::Index i = 0; i < nitemsw; ++i)
- if (name == items[i]->name())
- return i;
- return -1;
- @@ -51,19 +51,19 @@ template <typename T> struct Descr_Maintainer {
-
- int32_t get_index(const char * const name) const throw (Nonexistent)
- {
- - for (typename T::Index i = 0; i < nitems; ++i)
- + for (typename T::Index i = 0; i < nitemsw; ++i)
- if (name == items[i]->name())
- return i;
- return -1;
- }
-
- T * get(int32_t const idx) const {
- - return idx >= 0 and idx < static_cast<int32_t>(nitems) ? items[idx] : 0;
- + return idx >= 0 and idx < static_cast<int32_t>(nitemsw) ? items[idx] : 0;
- }
-
- private:
- typename T::Index capacity;
- - typename T::Index nitems;
- + typename T::Index nitemsw;
- T * * items;
-
- void reserve(const typename T::Index n) {
- @@ -79,9 +79,9 @@ template <typename T> struct Descr_Maintainer {
-
- template <typename T>
- int32_t Descr_Maintainer<T>::add(T * const item) {
- - int32_t const result = nitems;
- - if (++nitems >= capacity)
- - reserve(nitems);
- + int32_t const result = nitemsw;
- + if (++nitemsw >= capacity)
- + reserve(nitemsw);
- items[result] = item;
- return result;
- }
- @@ -89,14 +89,14 @@ int32_t Descr_Maintainer<T>::add(T * const item) {
- /// Returns the element if it exists, 0 otherwise.
- template <typename T>
- T * Descr_Maintainer<T>::exists(char const * const name) const {
- - for (typename T::Index i = 0; i < nitems; ++i)
- + for (typename T::Index i = 0; i < nitemsw; ++i)
- if (name == items[i]->name())
- return items[i];
- return 0;
- }
-
- template<typename T> Descr_Maintainer<T>::~Descr_Maintainer() {
- - for (typename T::Index i = 0; i < nitems; ++i)
- + for (typename T::Index i = 0; i < nitemsw; ++i)
- delete items[i];
- free(items);
- }
|