summaryrefslogtreecommitdiffstats
path: root/src/methods/methods.c.in
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-30 03:19:38 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-30 03:36:22 +0100
commit8088a82a2a91d29967cef920ba780eecdf72518e (patch)
treed30768bff5805e1209d64e9c0e7e87c38cce0042 /src/methods/methods.c.in
parent1111dc8e5e9e78254c1a7a891d961713e1be9db0 (diff)
downloadfastd-8088a82a2a91d29967cef920ba780eecdf72518e.tar
fastd-8088a82a2a91d29967cef920ba780eecdf72518e.zip
Perform string-based lookup of method-related information only once
Diffstat (limited to 'src/methods/methods.c.in')
-rw-r--r--src/methods/methods.c.in12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/methods/methods.c.in b/src/methods/methods.c.in
index 2a8d9fb..a2c7963 100644
--- a/src/methods/methods.c.in
+++ b/src/methods/methods.c.in
@@ -24,7 +24,7 @@
*/
-#include <src/fastd.h>
+#include <src/method.h>
@METHOD_DEFINITIONS@
@@ -33,12 +33,14 @@ static const fastd_method_t *const methods[] = { @METHOD_LIST@
};
-const fastd_method_t* fastd_method_get_by_name(const char *name) {
+bool fastd_method_create_by_name(const char *name, const fastd_method_t **method, fastd_method_context_t **method_ctx) {
size_t i;
for (i = 0; i < array_size(methods); i++) {
- if (methods[i]->provides(name))
- return methods[i];
+ if (methods[i]->create_by_name(name, method_ctx)) {
+ *method = methods[i];
+ return true;
+ }
}
- return NULL;
+ return false;
}