[systemd-devel] [PATCH 2/4] shared: mark strv_length() _pure_

Shawn Landden shawn at churchofgit.com
Sun Dec 1 16:57:39 PST 2013


On Sun, Dec 1, 2013 at 3:59 PM, Zbigniew Jędrzejewski-Szmek
<zbyszek at in.waw.pl> wrote:
> On Sun, Dec 01, 2013 at 02:50:15PM -0800, Shawn Landden wrote:
>> ---
>>  src/shared/strv.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/shared/strv.c b/src/shared/strv.c
>> index 607c221..cc6adfa 100644
>> --- a/src/shared/strv.c
>> +++ b/src/shared/strv.c
>> @@ -84,7 +84,7 @@ char **strv_copy(char * const *l) {
>>          return r;
>>  }
>>
>> -unsigned strv_length(char * const *l) {
>> +_pure_ unsigned strv_length(char * const *l) {
>>          unsigned n = 0;
>>
> _pure_ only makes sense in .h files, except for static functions of course, which
> are not declared in an .h file. This annotation tells the compiler how to optimize
> calls to the function, so it must be available where it is used.
yes indeed, and in the .h file its already _pure_.
>
> Zbyszek
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list