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

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sun Dec 1 15:59:14 PST 2013


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.

Zbyszek


More information about the systemd-devel mailing list