]> git.saurik.com Git - apt.git/commit
Remap StringView instances pointing into the cache
authorJulian Andres Klode <jak@debian.org>
Sat, 23 Jan 2016 12:15:31 +0000 (13:15 +0100)
committerJulian Andres Klode <jak@debian.org>
Sat, 23 Jan 2016 14:20:52 +0000 (15:20 +0100)
commit7dd0c2eb45874d3df9a9ee2034501659548a1b97
tree1c431a2f46c51492d216fa1f8e3e9b17c1466d6a
parent19819ac58a420275e0ae9aa7e2a34c72cba8af5e
Remap StringView instances pointing into the cache

It turns out that StringViews might need to be remapped in some
places because they come from the cache. For example, some sites
pass a Ver.VerStr() to NewProvides().

Such a StringView would become invalid during the duration of
the call if the cache is remapped, causing the program to die
with a segmentation fault.

We can take care of those issues by remapping string views in
the same way we remap all the iterators. String views are only
remapped if they point into the cache though, this allows us
to write more generic code on the callee site without having
to check whether the view points into the cache or not.
That's not as efficient as possible, but the overhead does not
appear to be measurable.

Closes: #812251
apt-pkg/pkgcachegen.cc