Pārlūkot izejas kodu

ncd: modules: remove concatv, implement it in concat module instead, more efficiently

ambrop7 13 gadi atpakaļ
vecāks
revīzija
6583f5e8f6

+ 0 - 1
blog_channels.txt

@@ -9,7 +9,6 @@ ncd_depend 4
 ncd_multidepend 4
 ncd_dynamic_depend 4
 ncd_concat 4
-ncd_concatv 4
 ncd_if 4
 ncd_strcmp 4
 ncd_regex_match 4

+ 0 - 4
generated/blog_channel_ncd_concatv.h

@@ -1,4 +0,0 @@
-#ifdef BLOG_CURRENT_CHANNEL
-#undef BLOG_CURRENT_CHANNEL
-#endif
-#define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_concatv

+ 126 - 127
generated/blog_channels_defines.h

@@ -9,130 +9,129 @@
 #define BLOG_CHANNEL_ncd_multidepend 8
 #define BLOG_CHANNEL_ncd_dynamic_depend 9
 #define BLOG_CHANNEL_ncd_concat 10
-#define BLOG_CHANNEL_ncd_concatv 11
-#define BLOG_CHANNEL_ncd_if 12
-#define BLOG_CHANNEL_ncd_strcmp 13
-#define BLOG_CHANNEL_ncd_regex_match 14
-#define BLOG_CHANNEL_ncd_logical 15
-#define BLOG_CHANNEL_ncd_sleep 16
-#define BLOG_CHANNEL_ncd_print 17
-#define BLOG_CHANNEL_ncd_blocker 18
-#define BLOG_CHANNEL_ncd_run 19
-#define BLOG_CHANNEL_ncd_runonce 20
-#define BLOG_CHANNEL_ncd_daemon 21
-#define BLOG_CHANNEL_ncd_spawn 22
-#define BLOG_CHANNEL_ncd_call 23
-#define BLOG_CHANNEL_ncd_imperative 24
-#define BLOG_CHANNEL_ncd_ref 25
-#define BLOG_CHANNEL_ncd_index 26
-#define BLOG_CHANNEL_ncd_alias 27
-#define BLOG_CHANNEL_ncd_process_manager 28
-#define BLOG_CHANNEL_ncd_ondemand 29
-#define BLOG_CHANNEL_ncd_foreach 30
-#define BLOG_CHANNEL_ncd_choose 31
-#define BLOG_CHANNEL_ncd_net_backend_waitdevice 32
-#define BLOG_CHANNEL_ncd_net_backend_waitlink 33
-#define BLOG_CHANNEL_ncd_net_backend_badvpn 34
-#define BLOG_CHANNEL_ncd_net_backend_wpa_supplicant 35
-#define BLOG_CHANNEL_ncd_net_backend_rfkill 36
-#define BLOG_CHANNEL_ncd_net_up 37
-#define BLOG_CHANNEL_ncd_net_dns 38
-#define BLOG_CHANNEL_ncd_net_iptables 39
-#define BLOG_CHANNEL_ncd_net_ipv4_addr 40
-#define BLOG_CHANNEL_ncd_net_ipv4_route 41
-#define BLOG_CHANNEL_ncd_net_ipv4_dhcp 42
-#define BLOG_CHANNEL_ncd_net_ipv4_arp_probe 43
-#define BLOG_CHANNEL_ncd_net_watch_interfaces 44
-#define BLOG_CHANNEL_ncd_sys_watch_input 45
-#define BLOG_CHANNEL_ncd_sys_watch_usb 46
-#define BLOG_CHANNEL_ncd_sys_evdev 47
-#define BLOG_CHANNEL_ncd_sys_watch_directory 48
-#define BLOG_CHANNEL_StreamPeerIO 49
-#define BLOG_CHANNEL_DatagramPeerIO 50
-#define BLOG_CHANNEL_BReactor 51
-#define BLOG_CHANNEL_BSignal 52
-#define BLOG_CHANNEL_FragmentProtoAssembler 53
-#define BLOG_CHANNEL_BPredicate 54
-#define BLOG_CHANNEL_ServerConnection 55
-#define BLOG_CHANNEL_Listener 56
-#define BLOG_CHANNEL_DataProto 57
-#define BLOG_CHANNEL_FrameDecider 58
-#define BLOG_CHANNEL_BSocksClient 59
-#define BLOG_CHANNEL_BDHCPClientCore 60
-#define BLOG_CHANNEL_BDHCPClient 61
-#define BLOG_CHANNEL_NCDIfConfig 62
-#define BLOG_CHANNEL_BUnixSignal 63
-#define BLOG_CHANNEL_BProcess 64
-#define BLOG_CHANNEL_PRStreamSink 65
-#define BLOG_CHANNEL_PRStreamSource 66
-#define BLOG_CHANNEL_PacketProtoDecoder 67
-#define BLOG_CHANNEL_DPRelay 68
-#define BLOG_CHANNEL_BThreadWork 69
-#define BLOG_CHANNEL_DPReceive 70
-#define BLOG_CHANNEL_BInputProcess 71
-#define BLOG_CHANNEL_NCDUdevMonitorParser 72
-#define BLOG_CHANNEL_NCDUdevMonitor 73
-#define BLOG_CHANNEL_NCDUdevCache 74
-#define BLOG_CHANNEL_NCDUdevManager 75
-#define BLOG_CHANNEL_BTime 76
-#define BLOG_CHANNEL_BEncryption 77
-#define BLOG_CHANNEL_SPProtoDecoder 78
-#define BLOG_CHANNEL_LineBuffer 79
-#define BLOG_CHANNEL_BTap 80
-#define BLOG_CHANNEL_lwip 81
-#define BLOG_CHANNEL_NCDConfigTokenizer 82
-#define BLOG_CHANNEL_NCDConfigParser 83
-#define BLOG_CHANNEL_NCDValParser 84
-#define BLOG_CHANNEL_nsskey 85
-#define BLOG_CHANNEL_addr 86
-#define BLOG_CHANNEL_PasswordListener 87
-#define BLOG_CHANNEL_NCDInterfaceMonitor 88
-#define BLOG_CHANNEL_NCDRfkillMonitor 89
-#define BLOG_CHANNEL_udpgw 90
-#define BLOG_CHANNEL_UdpGwClient 91
-#define BLOG_CHANNEL_SocksUdpGwClient 92
-#define BLOG_CHANNEL_BNetwork 93
-#define BLOG_CHANNEL_BConnection 94
-#define BLOG_CHANNEL_BSSLConnection 95
-#define BLOG_CHANNEL_BDatagram 96
-#define BLOG_CHANNEL_PeerChat 97
-#define BLOG_CHANNEL_BArpProbe 98
-#define BLOG_CHANNEL_NCDModuleIndex 99
-#define BLOG_CHANNEL_NCDModuleProcess 100
-#define BLOG_CHANNEL_NCDValGenerator 101
-#define BLOG_CHANNEL_ncd_from_string 102
-#define BLOG_CHANNEL_ncd_to_string 103
-#define BLOG_CHANNEL_ncd_value 104
-#define BLOG_CHANNEL_ncd_try 105
-#define BLOG_CHANNEL_ncd_sys_request_server 106
-#define BLOG_CHANNEL_NCDRequest 107
-#define BLOG_CHANNEL_ncd_net_ipv6_wait_dynamic_addr 108
-#define BLOG_CHANNEL_NCDRequestClient 109
-#define BLOG_CHANNEL_ncd_request 110
-#define BLOG_CHANNEL_ncd_sys_request_client 111
-#define BLOG_CHANNEL_ncd_exit 112
-#define BLOG_CHANNEL_ncd_getargs 113
-#define BLOG_CHANNEL_ncd_arithmetic 114
-#define BLOG_CHANNEL_ncd_parse 115
-#define BLOG_CHANNEL_ncd_valuemetic 116
-#define BLOG_CHANNEL_ncd_file 117
-#define BLOG_CHANNEL_ncd_netmask 118
-#define BLOG_CHANNEL_ncd_implode 119
-#define BLOG_CHANNEL_ncd_call2 120
-#define BLOG_CHANNEL_ncd_assert 121
-#define BLOG_CHANNEL_ncd_reboot 122
-#define BLOG_CHANNEL_ncd_explode 123
-#define BLOG_CHANNEL_NCDPlaceholderDb 124
-#define BLOG_CHANNEL_NCDVal 125
-#define BLOG_CHANNEL_ncd_net_ipv6_addr 126
-#define BLOG_CHANNEL_ncd_net_ipv6_route 127
-#define BLOG_CHANNEL_ncd_net_ipv4_addr_in_network 128
-#define BLOG_CHANNEL_ncd_net_ipv6_addr_in_network 129
-#define BLOG_CHANNEL_dostest_server 130
-#define BLOG_CHANNEL_dostest_attacker 131
-#define BLOG_CHANNEL_ncd_timer 132
-#define BLOG_CHANNEL_ncd_file_open 133
-#define BLOG_CHANNEL_ncd_backtrack 134
-#define BLOG_CHANNEL_ncd_socket 135
-#define BLOG_CHANNEL_ncd_depend_scope 136
-#define BLOG_NUM_CHANNELS 137
+#define BLOG_CHANNEL_ncd_if 11
+#define BLOG_CHANNEL_ncd_strcmp 12
+#define BLOG_CHANNEL_ncd_regex_match 13
+#define BLOG_CHANNEL_ncd_logical 14
+#define BLOG_CHANNEL_ncd_sleep 15
+#define BLOG_CHANNEL_ncd_print 16
+#define BLOG_CHANNEL_ncd_blocker 17
+#define BLOG_CHANNEL_ncd_run 18
+#define BLOG_CHANNEL_ncd_runonce 19
+#define BLOG_CHANNEL_ncd_daemon 20
+#define BLOG_CHANNEL_ncd_spawn 21
+#define BLOG_CHANNEL_ncd_call 22
+#define BLOG_CHANNEL_ncd_imperative 23
+#define BLOG_CHANNEL_ncd_ref 24
+#define BLOG_CHANNEL_ncd_index 25
+#define BLOG_CHANNEL_ncd_alias 26
+#define BLOG_CHANNEL_ncd_process_manager 27
+#define BLOG_CHANNEL_ncd_ondemand 28
+#define BLOG_CHANNEL_ncd_foreach 29
+#define BLOG_CHANNEL_ncd_choose 30
+#define BLOG_CHANNEL_ncd_net_backend_waitdevice 31
+#define BLOG_CHANNEL_ncd_net_backend_waitlink 32
+#define BLOG_CHANNEL_ncd_net_backend_badvpn 33
+#define BLOG_CHANNEL_ncd_net_backend_wpa_supplicant 34
+#define BLOG_CHANNEL_ncd_net_backend_rfkill 35
+#define BLOG_CHANNEL_ncd_net_up 36
+#define BLOG_CHANNEL_ncd_net_dns 37
+#define BLOG_CHANNEL_ncd_net_iptables 38
+#define BLOG_CHANNEL_ncd_net_ipv4_addr 39
+#define BLOG_CHANNEL_ncd_net_ipv4_route 40
+#define BLOG_CHANNEL_ncd_net_ipv4_dhcp 41
+#define BLOG_CHANNEL_ncd_net_ipv4_arp_probe 42
+#define BLOG_CHANNEL_ncd_net_watch_interfaces 43
+#define BLOG_CHANNEL_ncd_sys_watch_input 44
+#define BLOG_CHANNEL_ncd_sys_watch_usb 45
+#define BLOG_CHANNEL_ncd_sys_evdev 46
+#define BLOG_CHANNEL_ncd_sys_watch_directory 47
+#define BLOG_CHANNEL_StreamPeerIO 48
+#define BLOG_CHANNEL_DatagramPeerIO 49
+#define BLOG_CHANNEL_BReactor 50
+#define BLOG_CHANNEL_BSignal 51
+#define BLOG_CHANNEL_FragmentProtoAssembler 52
+#define BLOG_CHANNEL_BPredicate 53
+#define BLOG_CHANNEL_ServerConnection 54
+#define BLOG_CHANNEL_Listener 55
+#define BLOG_CHANNEL_DataProto 56
+#define BLOG_CHANNEL_FrameDecider 57
+#define BLOG_CHANNEL_BSocksClient 58
+#define BLOG_CHANNEL_BDHCPClientCore 59
+#define BLOG_CHANNEL_BDHCPClient 60
+#define BLOG_CHANNEL_NCDIfConfig 61
+#define BLOG_CHANNEL_BUnixSignal 62
+#define BLOG_CHANNEL_BProcess 63
+#define BLOG_CHANNEL_PRStreamSink 64
+#define BLOG_CHANNEL_PRStreamSource 65
+#define BLOG_CHANNEL_PacketProtoDecoder 66
+#define BLOG_CHANNEL_DPRelay 67
+#define BLOG_CHANNEL_BThreadWork 68
+#define BLOG_CHANNEL_DPReceive 69
+#define BLOG_CHANNEL_BInputProcess 70
+#define BLOG_CHANNEL_NCDUdevMonitorParser 71
+#define BLOG_CHANNEL_NCDUdevMonitor 72
+#define BLOG_CHANNEL_NCDUdevCache 73
+#define BLOG_CHANNEL_NCDUdevManager 74
+#define BLOG_CHANNEL_BTime 75
+#define BLOG_CHANNEL_BEncryption 76
+#define BLOG_CHANNEL_SPProtoDecoder 77
+#define BLOG_CHANNEL_LineBuffer 78
+#define BLOG_CHANNEL_BTap 79
+#define BLOG_CHANNEL_lwip 80
+#define BLOG_CHANNEL_NCDConfigTokenizer 81
+#define BLOG_CHANNEL_NCDConfigParser 82
+#define BLOG_CHANNEL_NCDValParser 83
+#define BLOG_CHANNEL_nsskey 84
+#define BLOG_CHANNEL_addr 85
+#define BLOG_CHANNEL_PasswordListener 86
+#define BLOG_CHANNEL_NCDInterfaceMonitor 87
+#define BLOG_CHANNEL_NCDRfkillMonitor 88
+#define BLOG_CHANNEL_udpgw 89
+#define BLOG_CHANNEL_UdpGwClient 90
+#define BLOG_CHANNEL_SocksUdpGwClient 91
+#define BLOG_CHANNEL_BNetwork 92
+#define BLOG_CHANNEL_BConnection 93
+#define BLOG_CHANNEL_BSSLConnection 94
+#define BLOG_CHANNEL_BDatagram 95
+#define BLOG_CHANNEL_PeerChat 96
+#define BLOG_CHANNEL_BArpProbe 97
+#define BLOG_CHANNEL_NCDModuleIndex 98
+#define BLOG_CHANNEL_NCDModuleProcess 99
+#define BLOG_CHANNEL_NCDValGenerator 100
+#define BLOG_CHANNEL_ncd_from_string 101
+#define BLOG_CHANNEL_ncd_to_string 102
+#define BLOG_CHANNEL_ncd_value 103
+#define BLOG_CHANNEL_ncd_try 104
+#define BLOG_CHANNEL_ncd_sys_request_server 105
+#define BLOG_CHANNEL_NCDRequest 106
+#define BLOG_CHANNEL_ncd_net_ipv6_wait_dynamic_addr 107
+#define BLOG_CHANNEL_NCDRequestClient 108
+#define BLOG_CHANNEL_ncd_request 109
+#define BLOG_CHANNEL_ncd_sys_request_client 110
+#define BLOG_CHANNEL_ncd_exit 111
+#define BLOG_CHANNEL_ncd_getargs 112
+#define BLOG_CHANNEL_ncd_arithmetic 113
+#define BLOG_CHANNEL_ncd_parse 114
+#define BLOG_CHANNEL_ncd_valuemetic 115
+#define BLOG_CHANNEL_ncd_file 116
+#define BLOG_CHANNEL_ncd_netmask 117
+#define BLOG_CHANNEL_ncd_implode 118
+#define BLOG_CHANNEL_ncd_call2 119
+#define BLOG_CHANNEL_ncd_assert 120
+#define BLOG_CHANNEL_ncd_reboot 121
+#define BLOG_CHANNEL_ncd_explode 122
+#define BLOG_CHANNEL_NCDPlaceholderDb 123
+#define BLOG_CHANNEL_NCDVal 124
+#define BLOG_CHANNEL_ncd_net_ipv6_addr 125
+#define BLOG_CHANNEL_ncd_net_ipv6_route 126
+#define BLOG_CHANNEL_ncd_net_ipv4_addr_in_network 127
+#define BLOG_CHANNEL_ncd_net_ipv6_addr_in_network 128
+#define BLOG_CHANNEL_dostest_server 129
+#define BLOG_CHANNEL_dostest_attacker 130
+#define BLOG_CHANNEL_ncd_timer 131
+#define BLOG_CHANNEL_ncd_file_open 132
+#define BLOG_CHANNEL_ncd_backtrack 133
+#define BLOG_CHANNEL_ncd_socket 134
+#define BLOG_CHANNEL_ncd_depend_scope 135
+#define BLOG_NUM_CHANNELS 136

+ 0 - 1
generated/blog_channels_list.h

@@ -9,7 +9,6 @@
 {"ncd_multidepend", 4},
 {"ncd_dynamic_depend", 4},
 {"ncd_concat", 4},
-{"ncd_concatv", 4},
 {"ncd_if", 4},
 {"ncd_strcmp", 4},
 {"ncd_regex_match", 4},

+ 0 - 1
ncd/CMakeLists.txt

@@ -134,7 +134,6 @@ add_library(ncdinterpreter
     modules/multidepend.c
     modules/dynamic_depend.c
     modules/concat.c
-    modules/concatv.c
     modules/if.c
     modules/strcmp.c
     modules/logical.c

+ 45 - 9
ncd/modules/concat.c

@@ -28,11 +28,15 @@
  * 
  * @section DESCRIPTION
  * 
- * String concatenation module.
+ * Synopsis:
+ *   concat([string elem ...])
+ *   concatv(list strings)
  * 
- * Synopsis: concat(string elem1, ..., string elemN)
- * Variables:
- *   string (empty) - elem1, ..., elemN concatenated
+ * Description:
+ *   Concatenates zero or more strings. The result is available as the empty
+ *   string variable. For concatv(), the strings are provided as a single
+ *   list argument. For concat(), the strings are provided as arguments
+ *   themselves.
  */
 
 #include <stddef.h>
@@ -66,17 +70,18 @@ static void result_ref_target_func_release (NCDRefTarget *ref_target)
     BFree(result);
 }
 
-static void func_new (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
+static void new_concat_common (void *vo, NCDModuleInst *i, NCDValRef list)
 {
+    ASSERT(NCDVal_IsList(list))
     struct instance *o = vo;
     o->i = i;
     
-    size_t count = NCDVal_ListCount(params->args);
+    size_t count = NCDVal_ListCount(list);
     bsize_t result_size = bsize_fromsize(sizeof(struct result));
     
     // check arguments and compute result size
     for (size_t j = 0; j < count; j++) {
-        NCDValRef arg = NCDVal_ListGet(params->args, j);
+        NCDValRef arg = NCDVal_ListGet(list, j);
         
         if (!NCDVal_IsString(arg)) {
             ModuleLog(i, BLOG_ERROR, "wrong type");
@@ -99,7 +104,7 @@ static void func_new (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new
     // copy data to result
     o->result->length = 0;
     for (size_t j = 0; j < count; j++) {
-        NCDValRef arg = NCDVal_ListGet(params->args, j);
+        NCDValRef arg = NCDVal_ListGet(list, j);
         size_t this_len = NCDVal_StringLength(arg);
         memcpy(o->result->data + o->result->length, NCDVal_StringData(arg), this_len);
         o->result->length += this_len;
@@ -114,6 +119,31 @@ fail0:
     NCDModuleInst_Backend_Dead(i);
 }
 
+static void func_new_concat (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
+{
+    new_concat_common(vo, i, params->args);
+}
+
+static void func_new_concatv (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
+{
+    NCDValRef list_arg;
+    if (!NCDVal_ListRead(params->args, 1, &list_arg)) {
+        ModuleLog(i, BLOG_ERROR, "wrong arity");
+        goto fail0;
+    }
+    if (!NCDVal_IsList(list_arg)) {
+        ModuleLog(i, BLOG_ERROR, "wrong type");
+        goto fail0;
+    }
+    
+    new_concat_common(vo, i, list_arg);
+    return;
+    
+fail0:
+    NCDModuleInst_Backend_SetError(i);
+    NCDModuleInst_Backend_Dead(i);
+}
+
 static void func_die (void *vo)
 {
     struct instance *o = vo;
@@ -142,7 +172,13 @@ static int func_getvar2 (void *vo, NCD_string_id_t name, NCDValMem *mem, NCDValR
 static struct NCDModule modules[] = {
     {
         .type = "concat",
-        .func_new2 = func_new,
+        .func_new2 = func_new_concat,
+        .func_die = func_die,
+        .func_getvar2 = func_getvar2,
+        .alloc_size = sizeof(struct instance)
+    }, {
+        .type = "concatv",
+        .func_new2 = func_new_concatv,
         .func_die = func_die,
         .func_getvar2 = func_getvar2,
         .alloc_size = sizeof(struct instance)

+ 0 - 147
ncd/modules/concatv.c

@@ -1,147 +0,0 @@
-/**
- * @file concatv.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.
- * 
- * @section DESCRIPTION
- * 
- * String concatenation module.
- * 
- * Synopsis: concatv(list(string) strings)
- * Variables:
- *   string (empty) - elements of strings concatenated
- */
-
-#include <stdlib.h>
-
-#include <misc/expstring.h>
-#include <ncd/NCDModule.h>
-#include <ncd/static_strings.h>
-
-#include <generated/blog_channel_ncd_concatv.h>
-
-#define ModuleLog(i, ...) NCDModuleInst_Backend_Log((i), BLOG_CURRENT_CHANNEL, __VA_ARGS__)
-
-struct instance {
-    NCDModuleInst *i;
-    uint8_t *string;
-    size_t len;
-};
-
-static void func_new (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
-{
-    struct instance *o = vo;
-    o->i = i;
-    
-    // read arguments
-    NCDValRef strings_arg;
-    if (!NCDVal_ListRead(params->args, 1, &strings_arg)) {
-        ModuleLog(o->i, BLOG_ERROR, "wrong arity");
-        goto fail0;
-    }
-    if (!NCDVal_IsList(strings_arg)) {
-        ModuleLog(o->i, BLOG_ERROR, "wrong type");
-        goto fail0;
-    }
-    
-    // init string
-    ExpString s;
-    if (!ExpString_Init(&s)) {
-        ModuleLog(i, BLOG_ERROR, "ExpString_Init failed");
-        goto fail0;
-    }
-    
-    // append arguments
-    size_t count = NCDVal_ListCount(strings_arg);
-    for (size_t j = 0; j < count; j++) {
-        NCDValRef arg = NCDVal_ListGet(strings_arg, j);
-        
-        if (!NCDVal_IsString(arg)) {
-            ModuleLog(i, BLOG_ERROR, "wrong type");
-            goto fail1;
-        }
-        
-        if (!ExpString_AppendBinary(&s, (const uint8_t *)NCDVal_StringData(arg), NCDVal_StringLength(arg))) {
-            ModuleLog(i, BLOG_ERROR, "ExpString_Append failed");
-            goto fail1;
-        }
-    }
-    
-    // set string
-    o->string = (uint8_t *)ExpString_Get(&s);
-    o->len = ExpString_Length(&s);
-    
-    // signal up
-    NCDModuleInst_Backend_Up(o->i);
-    return;
-    
-fail1:
-    ExpString_Free(&s);
-fail0:
-    NCDModuleInst_Backend_SetError(i);
-    NCDModuleInst_Backend_Dead(i);
-}
-
-static void func_die (void *vo)
-{
-    struct instance *o = vo;
-    
-    // free string
-    free(o->string);
-    
-    NCDModuleInst_Backend_Dead(o->i);
-}
-
-static int func_getvar2 (void *vo, NCD_string_id_t name, NCDValMem *mem, NCDValRef *out)
-{
-    struct instance *o = vo;
-    
-    if (name == NCD_STRING_EMPTY) {
-        *out = NCDVal_NewStringBin(mem, o->string, o->len);
-        if (NCDVal_IsInvalid(*out)) {
-            ModuleLog(o->i, BLOG_ERROR, "NCDVal_NewStringBin failed");
-        }
-        return 1;
-    }
-    
-    return 0;
-}
-
-static struct NCDModule modules[] = {
-    {
-        .type = "concatv",
-        .func_new2 = func_new,
-        .func_die = func_die,
-        .func_getvar2 = func_getvar2,
-        .alloc_size = sizeof(struct instance)
-    }, {
-        .type = NULL
-    }
-};
-
-const struct NCDModuleGroup ncdmodule_concatv = {
-    .modules = modules
-};

+ 0 - 2
ncd/modules/modules.h

@@ -40,7 +40,6 @@ extern const struct NCDModuleGroup ncdmodule_depend;
 extern const struct NCDModuleGroup ncdmodule_multidepend;
 extern const struct NCDModuleGroup ncdmodule_dynamic_depend;
 extern const struct NCDModuleGroup ncdmodule_concat;
-extern const struct NCDModuleGroup ncdmodule_concatv;
 extern const struct NCDModuleGroup ncdmodule_if;
 extern const struct NCDModuleGroup ncdmodule_strcmp;
 extern const struct NCDModuleGroup ncdmodule_logical;
@@ -122,7 +121,6 @@ static const struct NCDModuleGroup *ncd_modules[] = {
     &ncdmodule_multidepend,
     &ncdmodule_dynamic_depend,
     &ncdmodule_concat,
-    &ncdmodule_concatv,
     &ncdmodule_if,
     &ncdmodule_strcmp,
     &ncdmodule_logical,