This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=ff9cc777dcf77fa66b38be295821d4673ab8ac3a commit ff9cc777dcf77fa66b38be295821d4673ab8ac3a Author: Guillem Jover <[email protected]> AuthorDate: Tue Dec 6 19:44:33 2022 +0100 libcompat: Switch manual copying to memcpy() in obstack module This is shorter, and should be more performant on any system with a decently optimized memcpy() implementation. --- lib/compat/obstack.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/compat/obstack.c b/lib/compat/obstack.c index 13975aa41..a9b12187e 100644 --- a/lib/compat/obstack.c +++ b/lib/compat/obstack.c @@ -251,8 +251,6 @@ _obstack_newchunk (struct obstack *h, int length) struct _obstack_chunk *new_chunk; long new_size; long obj_size = h->next_free - h->object_base; - long i; - long already; char *object_base; /* Compute size for new chunk. */ @@ -272,25 +270,8 @@ _obstack_newchunk (struct obstack *h, int length) object_base = __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask); - /* Move the existing object to the new chunk. - Word at a time is fast and is safe if the object - is sufficiently aligned. */ - if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) - { - for (i = obj_size / sizeof (COPYING_UNIT) - 1; - i >= 0; i--) - ((COPYING_UNIT *)object_base)[i] - = ((COPYING_UNIT *)h->object_base)[i]; - /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, - but that can cross a page boundary on a machine - which does not do strict alignment for COPYING_UNITS. */ - already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); - } - else - already = 0; - /* Copy remaining bytes one by one. */ - for (i = already; i < obj_size; i++) - object_base[i] = h->object_base[i]; + /* Move the existing object to the new chunk. */ + memcpy(object_base, h->object_base, obj_size); /* If the object just copied was the only data in OLD_CHUNK, free that chunk and remove it from the chain. -- Dpkg.Org's dpkg

