summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
995d35b)
It's not completely obvious what is going on here and *why* we not
just go with a simple pointer array for the messages returned by
osl_strerror(). This commit explains why pointer arrays are bad
in DSOs.
#include "util.h"
#include "osl_core.h"
#include "util.h"
#include "osl_core.h"
-/* Taken from Drepper: How to write shared libraries, Appendix B. */
+/*
+ * Taken from Drepper: How to write shared libraries, Appendix B.
+ *
+ * The main reason for this rather fancy implementation of strerror() is to
+ * avoid having an array of pointers. This is desirable because initialized
+ * pointer variables increase the startup time of the library due to the
+ * processing of relocations.
+ */
#include <stddef.h>
#define MSGSTRFIELD(line) MSGSTRFIELD1(line)
#define MSGSTRFIELD1(line) str##line
#include <stddef.h>
#define MSGSTRFIELD(line) MSGSTRFIELD1(line)
#define MSGSTRFIELD1(line) str##line