#8931 closed patch
SearchSet: Get rid of SharedPtr usage
Reported by: | lordhoto | Owned by: | lordhoto |
---|---|---|---|
Priority: | normal | Component: | --Other-- |
Version: | Keywords: | ||
Cc: | Game: |
Description
Hi,
this patch removes the ArchivePtr parameter in SearchSet::add and replaces it with a plain pointer + bool variable which indicates if the given pointer should be freed on deletion. The 'autoFree' flag is true on default. We might want to check about this.
One of the reasons for that change is that now I'm able to add SearchMan to my own SearchSet in KYRA (Fixes bug #2103506 "KYRA: Kyra.dat is not search in all dirs anymore"). Also some code in PARALLACTION is now simplified, instead of first creating a ArchivePtr and then passing it to SearchSet::add, now PARALLACTION can simply use "_sset.add("part", _baseDir->getSubDirectory(name, 3), 10);". It might help in other cases too. So all in all it should get rid of the overhead of SharedPtr in this case and ease use of own SearchSet in conjunction with SearchMan.
Ticket imported from: #2184529. Ticket imported from: patches/1036.
Attachments (2)
Change History (9)
by , 16 years ago
Attachment: | archive_ptr_v1.patch added |
---|
comment:2 by , 16 years ago
Nothing against this change. I think I will have to learn when to use this SharedPtr thing ;)
Let's see if there are other opinions :)
comment:3 by , 16 years ago
Grrr, stupid SF.net just ate my comment *sigh*
Anyway, here it goes once more: I don't mind this patch being applied, I think I even suggested something along these lines in the past.
An alternative approach would be to change the Singleton class to use an ArchivePtr internally, then expose that ArchivePtr via some new Singleton API. That way, one could keep using ArchivePtrs, which at times is handy.
However, I am not convinced that this is such a good idea. And *not* using ArchivePtr of course saves us some overhead, and will help (a tiny bit) all ports with low memory & slow CPUs.
comment:4 by , 16 years ago
Yes we talked about that change, though I didn't hear peres official opinion on that. Anyway since you both agree I'll just commit it.
comment:5 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → closed |
Summary: | SearchSet: Get rid of SharedPtr usage → " |
comment:6 by , 16 years ago
Summary: | " → SearchSet: Get rid of SharedPtr usage |
---|
comment:7 by , 6 years ago
Component: | → --Other-- |
---|
Patch against r34831.