> I did that because it saves an extra line and the memory is freed right after the response is sent

True enough (2 extra lines in fact), but I think I must concur with @oni-link, it's still a useless `strlen()`  call. I think one or two lines is not going to make the difference. To make it even more copy-pastable ;):

```c
    char *str = (char *) ml_get_buf(buf, (linenr_T) lnum, false);
    size_t len = strlen(str);
    rv.items[i].data = xmemdup(str, len); // do these need to be NULL-terminated?
    rv.items[i].size = len;
```

But this could be easily abstracted into a function I think, since we use pass-by-value (which I love).

```c
String cstr_to_string(const char *str) {
    size_t len = strlen(str);
    return (String){
        .data = xmemdup(str, len),
        .size = str
    }
}

rv.items[i] = cstr_to_string((char *) ml_get_buf(buf, (linenr_T) lnum, false));
```

Now you have efficiency and line savings in one go ;).