On Tue, Apr 15, 2014 at 10:22:20AM -0700, john.johan...@canonical.com wrote:
> includes sbeattie's pad calculation fix.
> 
> Signed-off-by: John Johansen <john.johan...@canonical.com>

Acked-by: Seth Arnold <seth.arn...@canonical.com>

Wow, what a cleanup. :) that must have felt good.

Does it still make sense to have 'inline' in front of all these function
declarations? They feel complicated enough that I have trouble believing
they could be inlined.

> +inline void sd_write8(std::ostringstream &buf, u8 b)
>  {
> +     buf.write((const char *) &b, 1);
>  }

This could use buf.put(b) instead, if any function could be inlined this
would be the one you'd most want... Taking the address of a copied
parameter prevents it from just living in a register, right?

> +inline void sd_write_name(std::ostringstream &buf, const char *name)
>  {
>       PDEBUG("Writing name '%s'\n", name);
>       if (name) {
> +             sd_write8(buf, SD_NAME);
> +             sd_write16(buf, strlen(name) + 1);
> +             buf.write(name, strlen(name) + 1);
>       }
>  }

I think we should store aside strlen(name)+1 to avoid recomputing this.

>       if (profile->net.allow && kernel_supports_network) {
>               size_t i;
> +             sd_write_array(buf, "net_allowed_af", get_af_max());
>               for (i = 0; i < get_af_max(); i++) {

And here, also, I think we should store aside get_af_max() to avoid
recomputing it each loop iteration.

Thanks

Attachment: signature.asc
Description: Digital signature

-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to