patch-src_descr_maintainer_h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. $OpenBSD: patch-src_descr_maintainer_h,v 1.1 2014/03/27 04:00:25 bentley Exp $
  2. Conflicting macro.
  3. Committed upstream in bzr 6349.
  4. --- src/descr_maintainer.h.orig Sun Apr 15 16:49:17 2012
  5. +++ src/descr_maintainer.h Sun Apr 15 16:55:32 2012
  6. @@ -28,7 +28,7 @@
  7. * Worker_Descr and so on.
  8. */
  9. template <typename T> struct Descr_Maintainer {
  10. - Descr_Maintainer() : capacity(0), nitems(0), items(0) {}
  11. + Descr_Maintainer() : capacity(0), nitemsw(0), items(0) {}
  12. ~Descr_Maintainer();
  13. static typename T::Index invalid_index() {
  14. @@ -37,13 +37,13 @@ template <typename T> struct Descr_Maintainer {
  15. T * exists(char const * name) const;
  16. int32_t add(T *);
  17. - typename T::Index get_nitems() const throw () {return nitems;}
  18. + typename T::Index get_nitems() const throw () {return nitemsw;}
  19. struct Nonexistent {};
  20. int32_t get_index(std::string const & name) const throw (Nonexistent)
  21. {
  22. - for (typename T::Index i = 0; i < nitems; ++i)
  23. + for (typename T::Index i = 0; i < nitemsw; ++i)
  24. if (name == items[i]->name())
  25. return i;
  26. return -1;
  27. @@ -51,19 +51,19 @@ template <typename T> struct Descr_Maintainer {
  28. int32_t get_index(const char * const name) const throw (Nonexistent)
  29. {
  30. - for (typename T::Index i = 0; i < nitems; ++i)
  31. + for (typename T::Index i = 0; i < nitemsw; ++i)
  32. if (name == items[i]->name())
  33. return i;
  34. return -1;
  35. }
  36. T * get(int32_t const idx) const {
  37. - return idx >= 0 and idx < static_cast<int32_t>(nitems) ? items[idx] : 0;
  38. + return idx >= 0 and idx < static_cast<int32_t>(nitemsw) ? items[idx] : 0;
  39. }
  40. private:
  41. typename T::Index capacity;
  42. - typename T::Index nitems;
  43. + typename T::Index nitemsw;
  44. T * * items;
  45. void reserve(const typename T::Index n) {
  46. @@ -79,9 +79,9 @@ template <typename T> struct Descr_Maintainer {
  47. template <typename T>
  48. int32_t Descr_Maintainer<T>::add(T * const item) {
  49. - int32_t const result = nitems;
  50. - if (++nitems >= capacity)
  51. - reserve(nitems);
  52. + int32_t const result = nitemsw;
  53. + if (++nitemsw >= capacity)
  54. + reserve(nitemsw);
  55. items[result] = item;
  56. return result;
  57. }
  58. @@ -89,14 +89,14 @@ int32_t Descr_Maintainer<T>::add(T * const item) {
  59. /// Returns the element if it exists, 0 otherwise.
  60. template <typename T>
  61. T * Descr_Maintainer<T>::exists(char const * const name) const {
  62. - for (typename T::Index i = 0; i < nitems; ++i)
  63. + for (typename T::Index i = 0; i < nitemsw; ++i)
  64. if (name == items[i]->name())
  65. return items[i];
  66. return 0;
  67. }
  68. template<typename T> Descr_Maintainer<T>::~Descr_Maintainer() {
  69. - for (typename T::Index i = 0; i < nitems; ++i)
  70. + for (typename T::Index i = 0; i < nitemsw; ++i)
  71. delete items[i];
  72. free(items);
  73. }