]> git.tuebingen.mpg.de Git - paraslash.git/commit
string: Remove malloc attribute from para_realloc().
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 26 Oct 2021 18:19:58 +0000 (20:19 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 27 Oct 2021 19:44:04 +0000 (21:44 +0200)
commitb82f3288a37831f34bc7563eac316ba6879fd529
tree78d019c79a3fd89f7abf3e5425d2e18b4e521a7d
parent207c1184a2c8af338d6be70e8cb7ede10a5b6a08
string: Remove malloc attribute from para_realloc().

Quoting from the corresponding section of the gcc-10 manual:

This tells the compiler that a function is 'malloc'-like, i.e.,
that the pointer P returned by the function cannot alias any other
pointer valid when the function returns, and moreover no pointers to
valid objects occur in any storage addressed by P.

Using this attribute can improve optimization. Compiler predicts
that a function with the attribute returns non-null in most cases.
Functions like 'malloc' and 'calloc' have this property because they
return a pointer to uninitialized or zeroed-out storage. However,
functions like 'realloc' do not have this property, as they can return
a pointer to storage containing pointers.

Found by code inspection, the unpached code never caused problems.
Also, the function definition in string.c does not contain the
attribute.
string.h