Closed Bug 1247093 Opened 8 years ago Closed 8 years ago

Replace nsBaseHashtable::Enumerate() calls in purplexpcom

Categories

(Chat Core :: General, defect)

defect
Not set
blocker

Tracking

(Not tracked)

RESOLVED FIXED
Instantbird 47

People

(Reporter: aleth, Assigned: aleth)

References

Details

Attachments

(1 file)

/Users/buildbot/buildslave/macosx/build/mozilla/extensions/purple/purplexpcom/src/purpleGetText.cpp:492:8: error: unknown type name 'PLDHashOperator'
static PLDHashOperator deleteEnumerator(const nsACString &aKey,
       ^
/Users/buildbot/buildslave/macosx/build/mozilla/extensions/purple/purplexpcom/src/purpleGetText.cpp:498:11: error: use of undeclared identifier 'PLDHashOperator'
  return (PLDHashOperator) (PL_DHASH_REMOVE | PL_DHASH_NEXT);
          ^
/Users/buildbot/buildslave/macosx/build/mozilla/extensions/purple/purplexpcom/src/purpleGetText.cpp:498:29: error: use of undeclared identifier 'PL_DHASH_REMOVE'
  return (PLDHashOperator) (PL_DHASH_REMOVE | PL_DHASH_NEXT);
                            ^
/Users/buildbot/buildslave/macosx/build/mozilla/extensions/purple/purplexpcom/src/purpleGetText.cpp:498:47: error: use of undeclared identifier 'PL_DHASH_NEXT'
  return (PLDHashOperator) (PL_DHASH_REMOVE | PL_DHASH_NEXT);
                                              ^
/Users/buildbot/buildslave/macosx/build/mozilla/extensions/purple/purplexpcom/src/purpleGetText.cpp:514:41: error: no member named 'Enumerate' in 'nsDataHashtable<nsCStringHashKey, nsTArray<nsCString_external> *>'
      sInstance->mStringCache[i].table->Enumerate(deleteEnumerator, nullptr);
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
Sorry for the bustage -- where is this code located?

I'm happy to review patches for fixing.
Thanks! I'm not very familiar with this code (which lives in http://hg.mozilla.org/users/florian_queze.net/purple and is part of Instantbird) nor with iterators.
Attachment #8717655 - Flags: review?(n.nethercote)
Assignee: nobody → aleth
Status: NEW → ASSIGNED
Comment on attachment 8717655 [details] [diff] [review]
Replace nsBaseHashtable::Enumerate() calls in purplexpcom

Review of attachment 8717655 [details] [diff] [review]:
-----------------------------------------------------------------

::: purplexpcom/src/purpleGetText.cpp
@@ +502,5 @@
> +  for (PRUint32 i = 0; i < sInstance->mStringCache.Length(); ++i) {
> +    if (sInstance->mStringCache[i].table) {
> +      for (auto iter = sInstance->mStringCache[i].table->Iter();
> +           !iter.Done(); iter.Next()) {
> +        delete iter.Data();

After the |delete| you need to add this line (inside the loop):

> iter.Remove();

That's the equivalent to the PL_DHASH_REMOVE bit in the old return value.

Otherwise it looks good.
Attachment #8717655 - Flags: review?(n.nethercote) → review+
Thanks for the quick review!
https://hg.mozilla.org/users/florian_queze.net/purple/rev/270af9e2de0e
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Instantbird 47
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: