]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
compiler: add __hot attribute 2648/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 26 Sep 2018 12:52:27 +0000 (14:52 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 26 Sep 2018 12:52:27 +0000 (14:52 +0200)
This instructs the compiler to better optimize the config parsing code.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/compiler.h
src/lxc/confile.c
src/lxc/parse.h

index 76a7b733d008615a0a73f573a73c2c7811bc9bac..b6fbbc0e07cacd873c4a9788519069ed12f0a8e7 100644 (file)
 #endif
 #endif
 
+#ifndef __hot
+#      define __hot __attribute__((hot))
+#endif
+
 #define __cgfsng_ops
 
 #endif /* __LXC_COMPILER_H */
index c55ea787297d0babaab4667d6a1cdde73179f0c7..6312fdf90c2a25ce85e71cbff9e0b0ede8e01832 100644 (file)
 
 lxc_log_define(confile, lxc);
 
-#define lxc_config_define(name)                                                \
-       static int set_config_##name(const char *, const char *,               \
-                                    struct lxc_conf *, void *);               \
-       static int get_config_##name(const char *, char *, int,                \
-                                    struct lxc_conf *, void *);               \
-       static int clr_config_##name(const char *, struct lxc_conf *, void *);
+#define lxc_config_define(name)                                             \
+       __hot static int set_config_##name(const char *, const char *,      \
+                                          struct lxc_conf *, void *);      \
+       __hot static int get_config_##name(const char *, char *, int,       \
+                                          struct lxc_conf *, void *);      \
+       __hot static int clr_config_##name(const char *, struct lxc_conf *, \
+                                          void *);
 
 lxc_config_define(autodev);
 lxc_config_define(apparmor_allow_incomplete);
index 913472740960baf6f3cee6e71f361f8bda95234f..bea45ef12feb150098145225173cba132384ab5d 100644 (file)
 #include <stdio.h>
 #include <sys/types.h>
 
+#include "compiler.h"
+
 typedef int (*lxc_dir_cb)(const char *name, const char *directory,
                          const char *file, void *data);
 
 typedef int (*lxc_file_cb)(char *buffer, void *data);
 
-extern int lxc_file_for_each_line(const char *file, lxc_file_cb callback,
-                                 void* data);
+__hot extern int lxc_file_for_each_line(const char *file, lxc_file_cb callback,
+                                       void *data);
 
-extern int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback,
-                                      void *data);
+__hot extern int lxc_file_for_each_line_mmap(const char *file,
+                                            lxc_file_cb callback, void *data);
 
 /* mmap() wrapper. lxc_strmmap() will take care to \0-terminate files so that
  * normal string-handling functions can be used on the buffer. */