summaryrefslogtreecommitdiff
path: root/gitweb/static/js/lib/cookies.js
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-17 12:08:08 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-17 13:53:30 -0700
commit3fc4eab466a3758ff57d8c823f244e29550a48d2 (patch)
treebd3807acab2037c9943c9c06773131bc34cb78eb /gitweb/static/js/lib/cookies.js
parente73686f6e4a37183bff723ceff7cd74e50361fa8 (diff)
apply: refactor `struct image` to use a `struct strbuf`
The `struct image` uses a character array to track the pre- or postimage of a patch operation. This has multiple downsides: - It is somewhat hard to track memory ownership. In fact, we have several memory leaks in git-apply(1) because we do not (and cannot easily) free the buffer in all situations. - We have to reinvent the wheel and manually implement a lot of functionality that would already be provided by `struct strbuf`. - We have to carefully track whether `update_pre_post_images()` can do an in-place update of the postimage or whether it has to allocate a new buffer for it. This is all rather cumbersome, and especially `update_pre_post_images()` is really hard to understand as a consequence even though what it is doing is rather trivial. Refactor the code to use a `struct strbuf` instead, addressing all of the above. Like this we can easily perform in-place updates in all situations, the logic to perform those updates becomes way simpler and the lifetime of the buffer becomes a ton easier to track. This refactoring also plugs some leaking buffers as a side effect. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/static/js/lib/cookies.js')
0 files changed, 0 insertions, 0 deletions