Explorar el Código

ncd: modules: socket: improve performance by exposing the read data as an external string, avoiding a copy

ambrop7 hace 13 años
padre
commit
ef7afa8904
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      ncd/modules/socket.c

+ 2 - 2
ncd/modules/socket.c

@@ -736,9 +736,9 @@ static int read_func_getvar (void *vo, NCD_string_id_t name, NCDValMem *mem, NCD
     ASSERT(!o->con_inst)
     
     if (name == NCD_STRING_EMPTY) {
-        *out = NCDVal_NewStringBin(mem, (const uint8_t *)NCDBuf_Data(o->buf), o->read_size);
+        *out = NCDVal_NewExternalString(mem, NCDBuf_Data(o->buf), o->read_size, NCDBuf_RefTarget(o->buf));
         if (NCDVal_IsInvalid(*out)) {
-            ModuleLog(o->i, BLOG_ERROR, "NCDVal_NewStringBin failed");
+            ModuleLog(o->i, BLOG_ERROR, "NCDVal_NewExternalString failed");
         }
         return 1;
     }