search for: nbdkit_strndup_intern

Displaying 9 results from an estimated 9 matches for "nbdkit_strndup_intern".

Did you mean: nbdkit_strdup_intern
2020 Aug 27
0
[nbdkit PATCH v2 4/8] api: Add nbdkit_str[n]dup_intern helper
...allback would +induce a memory leak or otherwise complicate the plugin to perform +additional bookkeeping. For these cases, nbdkit provides a +convenience function for creating a copy of a string for better +lifetime management. + + const char *nbdkit_strdup_intern (const char *str); + const char *nbdkit_strndup_intern (const char *str, size_t n); + +Returns a copy of C<str>, possibly limited to a maximum of C<n> bytes, +so that the caller may reclaim str and use the copy in its place. If +the copy is created outside the scope of a connection (such as during +C<.load> or C<.config>), the...
2020 Sep 03
4
[PATCH nbdkit] server/public.c: Uninline nbdkit_strdup_intern to avoid compiler warning.
I'm not sure if this is a GCC bug or a bug in our code, but the attached workaround fixes it for me. Rich.
2020 Sep 03
0
[PATCH nbdkit] server/public.c: Uninline nbdkit_strdup_intern to avoid compiler warning.
Previously with GCC 10.2 this code produced: In function ‘nbdkit_strndup_intern’, inlined from ‘nbdkit_strdup_intern’ at public.c:839:10: public.c:827:10: error: ‘strndup’ specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] 827 | copy = strndup (str, n); | ^~~~~~~~~~~~~~~~ --- server/public.c...
2020 Aug 26
2
Re: [nbdkit PATCH 3/5] api: Add nbdkit_string_intern helper
...t; proliferation is a problem, you can combine strdup and strndup by > accepting -1 as a length to mean stop at NUL termination; but I'm less > worried about API proliferation and more about ease-of-use. Time for some name bike-shedding. How about: nbdkit_strdup_intern (const char *) nbdkit_strndup_intern (const char *s, size_t) and if we need something that permits embedded NUL (right now I don't have such a use) we could add nbdkit_memdup_intern (const void *s, size_t) -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
2020 Sep 03
1
Re: [PATCH nbdkit] server/public.c: Uninline nbdkit_strdup_intern to avoid compiler warning.
On 9/3/20 4:41 AM, Richard W.M. Jones wrote: > Previously with GCC 10.2 this code produced: > > In function ‘nbdkit_strndup_intern’, > inlined from ‘nbdkit_strdup_intern’ at public.c:839:10: > public.c:827:10: error: ‘strndup’ specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] > 827 | copy = strndup (str, n); > | ^~~~~~~~~~~~~~...
2020 Aug 26
0
Re: [nbdkit PATCH 3/5] api: Add nbdkit_string_intern helper
...you can combine strdup and strndup by > >accepting -1 as a length to mean stop at NUL termination; but I'm > >less worried about API proliferation and more about ease-of-use. > > Time for some name bike-shedding. How about: > > nbdkit_strdup_intern (const char *) > nbdkit_strndup_intern (const char *s, size_t) > > and if we need something that permits embedded NUL (right now I > don't have such a use) we could add > nbdkit_memdup_intern (const void *s, size_t) Seems good to me. Do you think we'll be able to get the final APIs into nbdkit this week? I don...
2020 Aug 27
10
[nbdkit PATCH v2 0/8] exportname filter
This is a revision of my .default_export work, plus new work on .export_descriptions and a new exportname filter. I think it is now ready to check in. Things I'd still like in 1.22: - the file plugin should implement .list_exports (patch already posted, but it needs rebasing on this series) - the ext2 filter should override .list_exports when in exportname mode - the nbd plugin should be
2020 Aug 25
3
Re: [nbdkit PATCH 3/5] api: Add nbdkit_string_intern helper
On Tue, Aug 25, 2020 at 10:46:57AM -0500, Eric Blake wrote: > + const char *nbdkit_string_intern (const char *str); > + > +Returns a copy of str, so that the caller may reclaim str and use the > +copy in its place. If the copy is created outside the scope of a > +connection (such as during C<.load>), the lifetime of the copy will > +last at least through C<.unload>;
2020 Sep 21
18
[nbdkit PATCH v3 00/14] exportname filter
It's been several weeks since I posted v2 (I got distracted by improving libnbd to better test things, which in turn surfaced some major memory leak problems in nbdsh that are now fixed). Many of the patches are minor rebases from v2, with the biggest changes being fallout from: - patch 2: rename nbdkit_add_default_export to nbdkit_use_default_export - overall: this missed 1.22, so update