瀏覽代碼

ncd: Refactor make_fast_names into NCDFastNames.

Ambroz Bizjak 11 年之前
父節點
當前提交
9c5480ca06
共有 6 個文件被更改,包括 197 次插入192 次删除
  1. 1 0
      ncd/CMakeLists.txt
  2. 131 0
      ncd/extra/NCDFastNames.c
  3. 51 0
      ncd/extra/NCDFastNames.h
  4. 0 154
      ncd/extra/make_fast_names.h
  5. 7 19
      ncd/modules/alias.c
  6. 7 19
      ncd/modules/call2.c

+ 1 - 0
ncd/CMakeLists.txt

@@ -31,6 +31,7 @@ if (NOT EMSCRIPTEN)
         extra/NCDIfConfig.c
         extra/NCDIfConfig.c
         extra/build_cmdline.c
         extra/build_cmdline.c
         extra/NCDBProcessOpts.c
         extra/NCDBProcessOpts.c
+        extra/NCDFastNames.c
         modules/command_template.c
         modules/command_template.c
         modules/event_template.c
         modules/event_template.c
         modules/regex_match.c
         modules/regex_match.c

+ 131 - 0
ncd/extra/NCDFastNames.c

@@ -0,0 +1,131 @@
+/**
+ * @file NCDFastNames.c
+ * @author Ambroz Bizjak <ambrop7@gmail.com>
+ * 
+ * @section LICENSE
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the
+ *    names of its contributors may be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+
+#include <misc/balloc.h>
+
+#include "NCDFastNames.h"
+
+static size_t count_names (const char *str, size_t str_len)
+{
+    size_t count = 1;
+    
+    while (str_len > 0) {
+        if (*str == '.') {
+            count++;
+        }
+        str++;
+        str_len--;
+    }
+    
+    return count;
+}
+
+static int add_name (NCDFastNames *o, NCDStringIndex *string_index, const char *str, size_t str_len, const char *remain, size_t remain_len)
+{
+    ASSERT(str)
+    ASSERT(!!o->dynamic_names == (o->num_names > NCD_NUM_FAST_NAMES))
+    
+    NCD_string_id_t id = NCDStringIndex_GetBin(string_index, str, str_len);
+    if (id < 0) {
+        return 0;
+    }
+    
+    if (o->num_names < NCD_NUM_FAST_NAMES) {
+        o->static_names[o->num_names++] = id;
+        return 1;
+    }
+    
+    if (o->num_names == NCD_NUM_FAST_NAMES) {
+        size_t num_more = (!remain ? 0 : count_names(remain, remain_len));
+        size_t num_all = o->num_names + 1 + num_more;
+        
+        if (!(o->dynamic_names = BAllocArray(num_all, sizeof(o->dynamic_names[0])))) {
+            return 0;
+        }
+        
+        memcpy(o->dynamic_names, o->static_names, NCD_NUM_FAST_NAMES * sizeof(o->dynamic_names[0]));
+    }
+    
+    o->dynamic_names[o->num_names++] = id;
+    
+    return 1;
+}
+
+int NCDFastNames_Init (NCDFastNames *o, NCDStringIndex *string_index, const char *str, size_t str_len)
+{
+    ASSERT(str)
+    
+    o->num_names = 0;
+    o->dynamic_names = NULL;
+    
+    size_t i = 0;
+    while (i < str_len) {
+        if (str[i] == '.') {
+            if (!add_name(o, string_index, str, i, str + (i + 1), str_len - (i + 1))) {
+                goto fail;
+            }
+            str += i + 1;
+            str_len -= i + 1;
+            i = 0;
+            continue;
+        }
+        i++;
+    }
+    
+    if (!add_name(o, string_index, str, i, NULL, 0)) {
+        goto fail;
+    }
+    
+    return 1;
+    
+fail:
+    BFree(o->dynamic_names);
+    return 0;
+}
+
+void NCDFastNames_Free (NCDFastNames *o)
+{
+    if (o->dynamic_names) {
+        BFree(o->dynamic_names);
+    }
+}
+
+size_t NCDFastNames_GetNumNames (NCDFastNames *o)
+{
+    ASSERT(o->num_names > 0)
+    
+    return o->num_names;
+}
+
+NCD_string_id_t * NCDFastNames_GetNames (NCDFastNames *o)
+{
+    return o->dynamic_names ? o->dynamic_names : o->static_names;
+}

+ 51 - 0
ncd/extra/NCDFastNames.h

@@ -0,0 +1,51 @@
+/**
+ * @file NCDFastNames.h
+ * @author Ambroz Bizjak <ambrop7@gmail.com>
+ * 
+ * @section LICENSE
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the
+ *    names of its contributors may be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BADVPN_NCD_FAST_NAMES_H
+#define BADVPN_NCD_FAST_NAMES_H
+
+#include <stddef.h>
+
+#include <misc/debug.h>
+#include <ncd/NCDStringIndex.h>
+
+#define NCD_NUM_FAST_NAMES 4
+
+typedef struct {
+    NCD_string_id_t *dynamic_names;
+    size_t num_names;
+    NCD_string_id_t static_names[NCD_NUM_FAST_NAMES];
+} NCDFastNames;
+
+int NCDFastNames_Init (NCDFastNames *o, NCDStringIndex *string_index, const char *str, size_t str_len) WARN_UNUSED;
+void NCDFastNames_Free (NCDFastNames *o);
+size_t NCDFastNames_GetNumNames (NCDFastNames *o);
+NCD_string_id_t * NCDFastNames_GetNames (NCDFastNames *o);
+
+#endif

+ 0 - 154
ncd/extra/make_fast_names.h

@@ -1,154 +0,0 @@
-/**
- * @file make_fast_names.h
- * @author Ambroz Bizjak <ambrop7@gmail.com>
- * 
- * @section LICENSE
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the
- *    names of its contributors may be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-
-#include <misc/debug.h>
-#include <misc/merge.h>
-#include <misc/balloc.h>
-#include <ncd/NCDStringIndex.h>
-
-// Input parameters:
-// #define NAMES_PARAM_NAME
-// #define NAMES_PARAM_TYPE struct instance
-// #define NAMES_PARAM_MEMBER_DYNAMIC_NAMES dynamic_names
-// #define NAMES_PARAM_MEMBER_STATIC_NAMES static_names
-// #define NAMES_PARAM_MEMBER_NUM_NAMES num_names
-// #define NAMES_PARAM_NUM_STATIC_NAMES 10
-
-#define MakeFastNames_count_names MERGE(NAMES_PARAM_NAME, _count_names)
-#define MakeFastNames_add_name MERGE(NAMES_PARAM_NAME, _add_name)
-#define MakeFastNames_InitNames MERGE(NAMES_PARAM_NAME, _InitNames)
-#define MakeFastNames_FreeNames MERGE(NAMES_PARAM_NAME, _FreeNames)
-#define MakeFastNames_GetNames MERGE(NAMES_PARAM_NAME, _GetNames)
-
-static size_t MakeFastNames_count_names (const char *str, size_t str_len)
-{
-    size_t count = 1;
-    
-    while (str_len > 0) {
-        if (*str == '.') {
-            count++;
-        }
-        str++;
-        str_len--;
-    }
-    
-    return count;
-}
-
-static int MakeFastNames_add_name (NAMES_PARAM_TYPE *o, NCDStringIndex *string_index, const char *str, size_t str_len, const char *remain, size_t remain_len)
-{
-    ASSERT(str)
-    ASSERT(!!o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES == (o->NAMES_PARAM_MEMBER_NUM_NAMES > NAMES_PARAM_NUM_STATIC_NAMES))
-    
-    NCD_string_id_t id = NCDStringIndex_GetBin(string_index, str, str_len);
-    if (id < 0) {
-        return 0;
-    }
-    
-    if (o->NAMES_PARAM_MEMBER_NUM_NAMES < NAMES_PARAM_NUM_STATIC_NAMES) {
-        o->NAMES_PARAM_MEMBER_STATIC_NAMES[o->NAMES_PARAM_MEMBER_NUM_NAMES++] = id;
-        return 1;
-    }
-    
-    if (o->NAMES_PARAM_MEMBER_NUM_NAMES == NAMES_PARAM_NUM_STATIC_NAMES) {
-        size_t num_more = (!remain ? 0 : MakeFastNames_count_names(remain, remain_len));
-        size_t num_all = o->NAMES_PARAM_MEMBER_NUM_NAMES + 1 + num_more;
-        
-        if (!(o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES = BAllocArray(num_all, sizeof(o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES[0])))) {
-            return 0;
-        }
-        
-        memcpy(o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES, o->NAMES_PARAM_MEMBER_STATIC_NAMES, NAMES_PARAM_NUM_STATIC_NAMES * sizeof(o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES[0]));
-    }
-    
-    o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES[o->NAMES_PARAM_MEMBER_NUM_NAMES++] = id;
-    
-    return 1;
-}
-
-static int MakeFastNames_InitNames (NAMES_PARAM_TYPE *o, NCDStringIndex *string_index, const char *str, size_t str_len)
-{
-    ASSERT(str)
-    
-    o->NAMES_PARAM_MEMBER_NUM_NAMES = 0;
-    o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES = NULL;
-    
-    size_t i = 0;
-    while (i < str_len) {
-        if (str[i] == '.') {
-            if (!MakeFastNames_add_name(o, string_index, str, i, str + (i + 1), str_len - (i + 1))) {
-                goto fail;
-            }
-            str += i + 1;
-            str_len -= i + 1;
-            i = 0;
-            continue;
-        }
-        i++;
-    }
-    
-    if (!MakeFastNames_add_name(o, string_index, str, i, NULL, 0)) {
-        goto fail;
-    }
-    
-    return 1;
-    
-fail:
-    BFree(o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES);
-    return 0;
-}
-
-static void MakeFastNames_FreeNames (NAMES_PARAM_TYPE *o)
-{
-    if (o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES) {
-        BFree(o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES);
-    }
-}
-
-static NCD_string_id_t * MakeFastNames_GetNames (NAMES_PARAM_TYPE *o)
-{
-    ASSERT(o->NAMES_PARAM_MEMBER_NUM_NAMES > 0)
-    
-    return (o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES ? o->NAMES_PARAM_MEMBER_DYNAMIC_NAMES : o->NAMES_PARAM_MEMBER_STATIC_NAMES);
-}
-
-#undef MakeFastNames_count_names
-#undef MakeFastNames_add_name
-#undef MakeFastNames_InitNames
-#undef MakeFastNames_FreeNames
-#undef MakeFastNames_GetNames
-
-#undef NAMES_PARAM_NAME
-#undef NAMES_PARAM_TYPE
-#undef NAMES_PARAM_MEMBER_DYNAMIC_NAMES
-#undef NAMES_PARAM_MEMBER_STATIC_NAMES
-#undef NAMES_PARAM_MEMBER_NUM_NAMES
-#undef NAMES_PARAM_NUM_STATIC_NAMES

+ 7 - 19
ncd/modules/alias.c

@@ -43,28 +43,17 @@
 
 
 #include <misc/debug.h>
 #include <misc/debug.h>
 #include <misc/balloc.h>
 #include <misc/balloc.h>
+#include <ncd/extra/NCDFastNames.h>
 
 
 #include <ncd/module_common.h>
 #include <ncd/module_common.h>
 
 
 #include <generated/blog_channel_ncd_alias.h>
 #include <generated/blog_channel_ncd_alias.h>
 
 
-#define NUM_STATIC_NAMES 4
-
 struct instance {
 struct instance {
     NCDModuleInst *i;
     NCDModuleInst *i;
-    NCD_string_id_t *dynamic_names;
-    size_t num_names;
-    NCD_string_id_t static_names[NUM_STATIC_NAMES];
+    NCDFastNames names;
 };
 };
 
 
-#define NAMES_PARAM_NAME AliasNames
-#define NAMES_PARAM_TYPE struct instance
-#define NAMES_PARAM_MEMBER_DYNAMIC_NAMES dynamic_names
-#define NAMES_PARAM_MEMBER_STATIC_NAMES static_names
-#define NAMES_PARAM_MEMBER_NUM_NAMES num_names
-#define NAMES_PARAM_NUM_STATIC_NAMES NUM_STATIC_NAMES
-#include <ncd/extra/make_fast_names.h>
-
 static void func_new (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
 static void func_new (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
 {
 {
     struct instance *o = vo;
     struct instance *o = vo;
@@ -82,8 +71,8 @@ static void func_new (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new
     }
     }
     
     
     // parse name string
     // parse name string
-    if (!AliasNames_InitNames(o, i->params->iparams->string_index, NCDVal_StringData(target_arg), NCDVal_StringLength(target_arg))) {
-        ModuleLog(i, BLOG_ERROR, "make_names failed");
+    if (!NCDFastNames_Init(&o->names, i->params->iparams->string_index, NCDVal_StringData(target_arg), NCDVal_StringLength(target_arg))) {
+        ModuleLog(i, BLOG_ERROR, "NCDFastNames_Init failed");
         goto fail0;
         goto fail0;
     }
     }
     
     
@@ -99,7 +88,7 @@ static void func_die (void *vo)
 {
 {
     struct instance *o = vo;
     struct instance *o = vo;
     
     
-    AliasNames_FreeNames(o);
+    NCDFastNames_Free(&o->names);
     
     
     NCDModuleInst_Backend_Dead(o->i);
     NCDModuleInst_Backend_Dead(o->i);
 }
 }
@@ -107,9 +96,8 @@ static void func_die (void *vo)
 static int func_getobj (void *vo, NCD_string_id_t name, NCDObject *out_object)
 static int func_getobj (void *vo, NCD_string_id_t name, NCDObject *out_object)
 {
 {
     struct instance *o = vo;
     struct instance *o = vo;
-    ASSERT(o->num_names > 0)
     
     
-    NCD_string_id_t *names = AliasNames_GetNames(o);
+    NCD_string_id_t *names = NCDFastNames_GetNames(&o->names);
     
     
     NCDObject object;
     NCDObject object;
     if (!NCDModuleInst_Backend_GetObj(o->i, names[0], &object)) {
     if (!NCDModuleInst_Backend_GetObj(o->i, names[0], &object)) {
@@ -117,7 +105,7 @@ static int func_getobj (void *vo, NCD_string_id_t name, NCDObject *out_object)
     }
     }
     
     
     NCDObject obj2;
     NCDObject obj2;
-    if (!NCDObject_ResolveObjExprCompact(&object, names + 1, o->num_names - 1, &obj2)) {
+    if (!NCDObject_ResolveObjExprCompact(&object, names + 1, NCDFastNames_GetNumNames(&o->names) - 1, &obj2)) {
         return 0;
         return 0;
     }
     }
     
     

+ 7 - 19
ncd/modules/call2.c

@@ -114,6 +114,7 @@
 #include <misc/debug.h>
 #include <misc/debug.h>
 #include <misc/offset.h>
 #include <misc/offset.h>
 #include <structure/LinkedList0.h>
 #include <structure/LinkedList0.h>
+#include <ncd/extra/NCDFastNames.h>
 
 
 #include <ncd/module_common.h>
 #include <ncd/module_common.h>
 
 
@@ -125,8 +126,6 @@
 #define STATE_TERMINATING 4
 #define STATE_TERMINATING 4
 #define STATE_NONE 5
 #define STATE_NONE 5
 
 
-#define NUM_STATIC_NAMES 4
-
 struct instance;
 struct instance;
 
 
 typedef void (*call_extra_free_cb) (struct instance *o);
 typedef void (*call_extra_free_cb) (struct instance *o);
@@ -140,9 +139,7 @@ struct instance {
 
 
 struct instance_with_caller_target {
 struct instance_with_caller_target {
     struct instance base;
     struct instance base;
-    NCD_string_id_t *dynamic_names;
-    size_t num_names;
-    NCD_string_id_t static_names[NUM_STATIC_NAMES];
+    NCDFastNames names;
 };
 };
 
 
 struct inline_code {
 struct inline_code {
@@ -157,14 +154,6 @@ struct inline_code_call {
     LinkedList0Node ic_node;
     LinkedList0Node ic_node;
 };
 };
 
 
-#define NAMES_PARAM_NAME CallNames
-#define NAMES_PARAM_TYPE struct instance_with_caller_target
-#define NAMES_PARAM_MEMBER_DYNAMIC_NAMES dynamic_names
-#define NAMES_PARAM_MEMBER_STATIC_NAMES static_names
-#define NAMES_PARAM_MEMBER_NUM_NAMES num_names
-#define NAMES_PARAM_NUM_STATIC_NAMES NUM_STATIC_NAMES
-#include <ncd/extra/make_fast_names.h>
-
 static void process_handler_event (NCDModuleProcess *process, int event);
 static void process_handler_event (NCDModuleProcess *process, int event);
 static int process_func_getspecialobj_embed (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object);
 static int process_func_getspecialobj_embed (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object);
 static int process_func_getspecialobj_noembed (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object);
 static int process_func_getspecialobj_noembed (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object);
@@ -256,9 +245,8 @@ static int caller_obj_func_getobj (const NCDObject *obj, NCD_string_id_t name, N
 static int caller_obj_func_getobj_with_caller_target (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object)
 static int caller_obj_func_getobj_with_caller_target (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object)
 {
 {
     struct instance_with_caller_target *o_ch = NCDObject_DataPtr(obj);
     struct instance_with_caller_target *o_ch = NCDObject_DataPtr(obj);
-    ASSERT(o_ch->num_names > 0)
     
     
-    NCD_string_id_t *names = CallNames_GetNames(o_ch);
+    NCD_string_id_t *names = NCDFastNames_GetNames(&o_ch->names);
     
     
     NCDObject object;
     NCDObject object;
     if (!NCDModuleInst_Backend_GetObj(o_ch->base.i, names[0], &object)) {
     if (!NCDModuleInst_Backend_GetObj(o_ch->base.i, names[0], &object)) {
@@ -266,7 +254,7 @@ static int caller_obj_func_getobj_with_caller_target (const NCDObject *obj, NCD_
     }
     }
     
     
     NCDObject obj2;
     NCDObject obj2;
-    if (!NCDObject_ResolveObjExprCompact(&object, names + 1, o_ch->num_names - 1, &obj2)) {
+    if (!NCDObject_ResolveObjExprCompact(&object, names + 1, NCDFastNames_GetNumNames(&o_ch->names) - 1, &obj2)) {
         return 0;
         return 0;
     }
     }
     
     
@@ -367,9 +355,9 @@ static void func_new_call_with_caller_target (void *vo, NCDModuleInst *i, const
     
     
     struct instance_with_caller_target *o = vo;
     struct instance_with_caller_target *o = vo;
     
     
-    int res = CallNames_InitNames(o, i->params->iparams->string_index, NCDVal_StringData(caller_target_arg), NCDVal_StringLength(caller_target_arg));
+    int res = NCDFastNames_Init(&o->names, i->params->iparams->string_index, NCDVal_StringData(caller_target_arg), NCDVal_StringLength(caller_target_arg));
     if (!res) {
     if (!res) {
-        ModuleLog(i, BLOG_ERROR, "CallerNames_InitNames failed");
+        ModuleLog(i, BLOG_ERROR, "NCDFastNames_Init failed");
         goto fail0;
         goto fail0;
     }
     }
     
     
@@ -384,7 +372,7 @@ static void call_with_caller_target_extra_free (struct instance *bo)
 {
 {
     struct instance_with_caller_target *o = (void *)bo;
     struct instance_with_caller_target *o = (void *)bo;
     
     
-    CallNames_FreeNames(o);
+    NCDFastNames_Free(&o->names);
 }
 }
 
 
 static void func_new_embcall_multif (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
 static void func_new_embcall_multif (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)